Skip to content

Api rest to register food on app, with NODEJS, KNEX, TYPESCRIPT and SQLITE/POSTGRESS

Notifications You must be signed in to change notification settings

Gabriel-Jesusvix/api-rest-daily-diet

Repository files navigation

Application Rules

  • It must be possible to create a user

  • It must be possible to identify the user between requests

  • It must be possible to record a meal eaten, with the following information:

    Meals must be related to a user.

    • Name
    • Description
    • Date and time
    • Is it on the diet or not
  • It must be possible to edit a meal, being able to change all the data above

  • It should be possible to delete a meal

  • It should be possible to list all of a user's meals

  • It must be possible to view a single meal

  • It must be possible to retrieve a user's metrics

    • Total number of meals recorded
    • Total number of meals within the diet
    • Total number of meals outside the diet
    • Best sequence of meals within the diet
  • The user can only view, edit, and delete the meals he created

Non-Functional Requirements

The application uses the Fastify backend framework, recognized for its efficiency and support for both JavaScript and TypeScript. Fastify is a micro framework with a minimalist approach to architecture, giving developers the freedom to define the most suitable architecture for the project. Furthermore, it offers full integration with TypeScript, facilitating the development of robust and scalable applications.

Environment management is carried out efficiently using DotEnv. This tool allows you to configure and access environment variables, simplifying configuration in different environments, such as development, testing, and production. In conjunction with Zod, a type validation library, we ensure that environment variables are consistent and suitable for the application to function, providing greater security and reliability.

To identify users within the application, we adopted the cookie strategy in conjunction with the FastifyCookies plugin. While there is not yet a full login system at this early stage of the MVP, this approach allows you to perform operations such as listing, removing, and changing meals based on the cookie associated with the user. This choice offers a simple and effective solution for managing individual interactions within the application.

Application Context

  • This application will allow the user to control their meals within a final objective, be it bodybuilding, hypertrophy, weight gain, etc.

Techs

  • Typescript
  • NodeJS
  • Fastify
  • Knex
  • SQLite / Postgres
  • Dotenv
  • Zod
  • TSX
  • Fastify Cookies

About

Api rest to register food on app, with NODEJS, KNEX, TYPESCRIPT and SQLITE/POSTGRESS

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published