Skip to content

gbdsantos/nodejs-investment-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ˆ Investiment Tracker

Fastify badge image Node.js badge image with version number PostgreSQL badge image Prisma logo imagem do logotipo Swagger TypeScript badge imag

read in the language

πŸ‡§πŸ‡· portuguese

About

Technical challenge/test consisting of a RESTful API built with Fastify, TypeScript, and PostgreSQL to manage investment goals, allowing users to create, list, update, and delete goals. The API ensures data validation with Zod, includes error handling, supports filtering by goal name and month, and is documented with Swagger.


πŸš€ Getting Started

# Install dependencies
npm install

# Create a new Docker environment
docker compose up -d

# Generate prisma client
npx prisma generate

# Run Prisma migrations (After first run is OPTIONAL)
npx prisma migrate dev

# Run project
npm run start:dev

⚠️ Remember to create the .env file with the environment variables.

To test the API endpoints, you can:

  • Access the Swagger documentation at http://localhost:3000/docs, where all routes are documented;
  • Use Visual Studio Code with the REST Client extension installed by opening the file named requests.http located in the project's root directory;
  • Use any REST client of your choice (e.g., Insomnia, Postman, etc).

Functional Requirements (FR)

  • The user must be able to register investment goal
  • The user must be able to list all investment goals
  • The user must be able to list a single investiment goal
  • The user must be able to edit investment goal.
  • The user must be able to exclude investment goals.

Non-Functional Requirements (NFR)

  • Fastify for API creation
  • PostgreSQL/Docker for the database

Business Requirements (BR)

  • The creation and update route must validate the submitted data, which includes: name, month(s), and value.
  • Additionally, the value must be evenly divided among the registered months.
  • The listing route must allow filters by name and month.

Extra mile

  • Automatic documentation with Swagger, typed with Zod

Tech Stack

  • Docker - Containerization for development environment
  • Fastify - Web framework for building high-performance APIs
  • Node.js - JavaScript runtime environment / plataform
  • PostgreSQL - Open source relational database
  • Prisma - ORM (Object Mapping Relation) for Node.js and TypeScript
  • Swagger - API Documentation & Design Tools for Teams
  • TypeScript - Programming language and superset for JavaScript
  • Vitest - Testing framework that use esbuild
  • Zod - TypeScript-first schema validations

βš–οΈ License

This project is licensed under the Creative Commons Attribution-NonCommercial (CC BY-NC 4.0) license. See LICENSE for more information.


Made with ❀️ by Guilherme Bezerra πŸ‘‹ Get in touch!

About

πŸ“Š A simple API for managing investments goals.

Topics

Resources

License

Stars

Watchers

Forks

Contributors