Transactions App is a simple Financial tracking tool made with love from Belo Horizonte, Brazil. It is not a complete application and it has the objetive to be an instructional repository to learn and teach backend development with JavaScript technologies, design patterns and clean architecture principles.
Related repositories:
TBD
Feel free to explore package.json dependencies and devDependencies to learn more. But in summary we have:
- Node.js, Express.js as core tecnologies
- Jest and Supertest for testing
- MariaDB (MySQL) with Sequelize at persistence layer
- And more
- The core objects is represented with Domain model pattern
- For object relational mapping was chose Sequelize ORM
- The application is organized in layers (routes, controller, models)
Before you starting clone this repository, make sure that you've already done the following steps:
-
Install nvm:
$ brew install nvm
-
After nvm installation, use it to install the proper version of node.js:
$ nvm use
-
Considering MAC OS, you may use homebrew to install a local MariaDB Server (Mysql) and then opt to start server as a service or manually. Installation and some security configurations:
$ brew install mariadb $ mysql_secure_installation
-
Install dependencies:
$ npm i
-
Create a
.env
file (you can duplicate.env.sample
) and configure your local dev environment varaibles. Remember that you should never commit this file. -
Execute the project:
$ npm run start:local
-
You can access the API in: http://localhost:3000/
Ps. The first time you run, make sure your database server is running and that all the migrations are up. More info bellow.
Start MariaDB server (Mac will re-start it at reboot)
$ brew services start mariadb
$ brew service list
$ brew services stop mariadb
Start MariaDB server (Mac will not re-start it at reboot)
$ mysql.server start
$ mysql.server status
$ mysql.server stop
To login on MariaDB server with/without password
$ mysql -u root -p
$ mysql -uroot
To create database and schema:
$ npm run db:create
$ npm run db:migrate
$ npm run db:migrate:status
To execute all unit tests:
$ npm run test
$ npm run test:watch
To execute all unit tests with coverage:
$ npm run test:coverage