69 lines
2.9 KiB
Markdown
69 lines
2.9 KiB
Markdown
# 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:
|
|
```bash
|
|
npm install
|
|
```
|
|
|
|
## Run Locally
|
|
Start the API:
|
|
```bash
|
|
npm run start:dev
|
|
```
|
|
To verify the API is running access the interactive [documentation](http://localhost:3000/common-cents/docs).
|
|
|
|
Default port (`3000`) can be changed by setting the `PORT=` environment variable.
|
|
|
|
Default prefix (`common-cents`) can be changed by setting the `PREFIX=` environment variable.
|
|
|
|
### Database
|
|
Supported configurations:
|
|
- SQLite (default)
|
|
- Local Postgres
|
|
- External Postgres (recommended)
|
|
|
|
For simplicity, SQLite is used in the `default`/`unconfigured` state.
|
|
|
|
To use Postgres set the `DB_TYPE=postgres` environment variable. Postgres defaults will look for a local instance, which can be satisfied by running the following `docker` container:
|
|
```bash
|
|
docker run --name common-cents-db -e POSTGRES_USER=common-cents -e POSTGRES_PASSWORD=CommonCents_123! -p 5432:5432 -d postgres
|
|
```
|
|
|
|
For external Postgres, configure additional environment variables. To simplify this, use an `env` file placed in the root directory (`common-cents-api/.env`):
|
|
```text
|
|
# .env
|
|
|
|
# API Config
|
|
PORT=3000
|
|
PREFIX=common-cents
|
|
DB_TYPE=sqlite # 'sqlite' or 'postgres'
|
|
DB_SYNC=true # Sync should be false for production
|
|
|
|
# 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](https://www.usebruno.com/) 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](https://docs.nestjs.com) to learn more about the framework.
|
|
- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
|
|
- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
|
|
- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
|
|
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
|
|
- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
|
|
- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
|
|
- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).
|