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.
# 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.httplocated in the project's root directory; - Use any REST client of your choice (e.g., Insomnia, Postman, etc).
- 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.
- Fastify for API creation
- PostgreSQL/Docker for the database
- 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.
- Automatic documentation with Swagger, typed with Zod
- 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
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!