2.8 KiB
common-cents-api
REST API for expense tracking and budgeting.
Project setup
Note: use no less than a currently supported LTS version of Node.
Install dependencies:
npm install
Run Locally
Start the API on localhost:3000
npm run start:dev
Default port (3000) can be changed by setting the PORT=xxxx environment variable.
Database
There are two databases that are supported:
- Postgres (recommended)
- SQLite (default for simplicity)
For simplicity SQLite is used as the database in the default/unconfigured state.
Using Postgres is pretty simple, by default the API is looking for a locally running instance, which can be satisfied by running the following docker container:
docker run --name common-cents-db -e POSTGRES_USER=common-cents -e POSTGRES_PASSWORD=CommonCents_123! -p 5432:5432 -d postgres
To specify Postgres as the database, set the DB_TYPE=postgres environment variable.
Alternatively, an external Postgres can be configured through additional environment variables. To simplify all of this, use an envfile placed in the root directory (common-cents-api/.env):
# .env
# Type 'sqlite' or 'postgres' (if not set sqlite will be used)
DB_TYPE=sqlite
# Sync should be false for production
DB_SYNC=true
# Postgres overrides
PG_HOST=localhost
PG_PORT=5432
PG_USER=common-cents
PG_PASS=CommonCents_123!
Bruno
The included bruno folder contains a collection of calls to make it more convenient to interact with the API. Local calls assume the default NestJS port (3000) is being used.
What's Bruno?
Bruno is alternative to Postman, unlike Postman it's fully open source, requires no subscription or account and collections are easily version controlled.
Resources
Check out a few resources that may come in handy when working with NestJS:
- Visit the NestJS Documentation to learn more about the framework.
- For questions and support, please visit our Discord channel.
- To dive deeper and get more hands-on experience, check out our official video courses.
- Deploy your application to AWS with the help of NestJS Mau in just a few clicks.
- Visualize your application graph and interact with the NestJS application in real-time using NestJS Devtools.
- Need help with your project (part-time to full-time)? Check out our official enterprise support.
- To stay in the loop and get updates, follow us on X and LinkedIn.
- Looking for a job, or have a job to offer? Check out our official Jobs board.