Skip to content

econominhas/backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Econominhas - Expenses Tracker

Style Guide: Econominhas Commitizen friendly

An app to track your finances and check if you are spending within your budget.

About

This project use lot's of tools to be as efficient as possible, here's the list with the links that you need to learn more about them.

Linting & Formatting

  • husky to run commands before commit
  • lint-staged to lint and format modified files before commit
  • editorconfig to help with linting
  • typescript to enforce type check and be easier to write self explanatory code
  • eslint find and fix problems in the code
  • prettier beautify code

Help Development

  • localstack to simulate AWS environment locally
  • docker & docker-compose to orchestrate (to "run") the api, database, localstack and all the heavy-external tools that we need to make the project work
  • nestjs framework to help with dependency injection and make the code more readable
  • github actions to run pipelines to deploy and validate things
  • pnpm package manager to decrease the size of the packages used for development

Documentation

  • prisma to document the database, generate the migrations, and communicate with the database (project's ORM)
  • dbdocs to host the database docs
  • openapi to document the API routes
    • We don't document the API using the code to don't bind us to any library or framework, this way we can be more tool agnostic and use the default way to document APIs: OpenAPI
  • redocly to compile the openapi docs in one file and validate if the syntax is correct

Hosted Docs

Running the API for the first time

  1. Copy and paste .env.example and rename the copy to .env.docker
  2. Run pnpm run start:dev
  3. Open another console tab and run pnpm run db:migrate
  4. The API will be available at http://localhost:3000/v1

Useful commands

Command Description
start:dev Run the project with all it's dependencies locally
openapi:serve Serve the API docs locally so you can validate your changes
openapi:postman Generate Postman json file (at openapi/postman.json)
lint:prisma Lint prisma schema
db:prisma Update the ORM types (You need to run this every time that you change prisma/schema.prisma)
test Run tests
test:cov Run tests and collect coverage
db:migrate Run the migrations
db:gen-migration <name> Generates a new migration based on the schema-database difference (you must run start:dev and db:migrate before run this!)

How to create a migration

  • Run pnpm run start:db
  • In another tab, run pnpm run db:gen-migration <migration name>

Teams

The teams names are based on different currencies around the world, but the countries that they are used don't have any influence on the things that the teams works on.

Team Responsible for Full list
Real Auth Accounts, SignInProvider, MagicLink, RefreshToken, TermsAndPolicies
Franc Profile Configs, Salary
Yuan Transactions Transactions, Recurrent transactions
Peso Cards Cards, Card Providers, Cards Bills
Rand Bank Accounts Bank Accounts, Bank Providers, Subscriptions
Rupee Budgets Budgets, Categories

Process to develop a new feature

The following documentation is to help you to understand the development process of every feature. It's a general documentation that should cover everything in the feature creation process, not all steps are required for every feature, so make sure to only follow the ones that your context needs.

The documentation is trying to achieve: 1 step = 1 task = 1 PR.

Planning & Documentation

This phase is the most important one, here we define exactly what we want to develop and how we are gonna to develop it.

All the changes, validations, usecases, flows, conditions, etc must be defined and documented here.

Description Assigners
Create a Story describing what we want to achieve PRODUCT OWNER
Architect a technical solution to achieve our goal and create tasks to document the API and Database changes

After this step, a estimation of time to develop this should be delivered to the PRODUCT OWNER, so he can decide if when this story should be done.
ARCHITECT AND DATABASE ENGINEER
Create a new branch for the story, following the pattern story/[story-id],

All the next steps must be done in branches derived from this branch, following the patter task/[task-id].
ARCHITECT
Update the database docs in ./prisma/schema.prisma and write the tasks to apply these changes on the code DATABASE ENGINEER
Update the API docs in ./openapi/* and write the tasks to apply these changes on the code ARCHITECT

Execution

This phase is were we convert the documentation to code and make everything works.

Description Assigners
If we need to use any external libraries, create an adapter in ./src/adapters/*.ts to wrap it and make it easier to change this dependency. DEVELOPER
Create or update the related entity models in ./src/models/*.ts DEVELOPER
Create or update the related entity repository in ./src/repositories/**/*-repository.{module,service}.ts following the entity's module specification

Obs: Remember to also write the unitary tests.
DEVELOPER
Create or update the related entity usecase in ./src/usecases/**/*.{module,service}.ts following the entity's module specification

Obs1: Remember to also add the usecase's module to the imports list of ./src/app.module.ts.
Obs2: Remember to also write the unitary tests.
DEVELOPER
Update the related entity controller in ./src/delivery/*.controller

Obs1: Remember to also add this controller to the usecase's module.
Obs2: Remember to also write the unitary tests.
DEVELOPER

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages