Alpe API Portal Financeiro developed in Node.js with database Postgres.
More info about project: Alpe - Project
- Docker, Node.js, JavaScript, Babel, Winston — core platform and dev tools
- Restify, Session — common HTTP-server features
- PostgreSQL, Oracledb — Database access
- Mocha - Test
- Node.Js Version
v8x
- Docker Community Edition v17 ou higher
- VS Code editor, ESLint plug-ins.
- Postgres Database.
- Verify node version
v10.15.0
. - Clone and run
npm i
git clone https://github.com/ITLAB-BR/alpe-api.git alpe-api
cd alpe-api # Change to the project directory
npm i # install all dependencies
- Setup project
- Env
- Copy the
.env.example
file and rename it to.env
. In this file you have add your configs informations.
- Copy the
- Then setup your application environment
- Env
npm run setup
- Serve Api and watch
npm start serve #serve api with typescript been transpiled in runtime and watches changes in ./src
or
npm start watch #build the api to javascript and watches changes in ./src
This starts a local server using
nodemon
, which will watch for any file changes and will restart the sever according to these changes. The server address will be displayed to you ashttp://localhost:8081
.
All script are defined in the package-scripts.js
file, but the most important ones are listed here.
- Install all dependencies with
npm i
- Run code quality analysis using
npm start lint
. This runs tslint. - There is also a vscode task for this called
lint
.
- Run the unit tests using
npm start test
(There is also a vscode task for this calledtest
). - Run the integration tests using
npm start test.integration
. - Run the e2e tests using
npm start test.e2e
.
- Create new seed using
npm "start db.seed_generate <file-name-seed>"
. - Run the seeds
npm start db.seed
.
- Create new migrations using
npm "start db.migrate_generate <file-name-migrate>"
. - Run the migrations
npm start db.migrate
.
- Run
npm start serve
to start nodemon with ts-node, to serve the app. - The server address will be displayed to you as
http://localhost:8081
- Run
npm start build
to generated all JavaScript files from the TypeScript sources (There is also a vscode task for this calledbuild
). - To start the builded app located in
dist
usenpm start
.
To debug your code run npm start build
or hit cmd + b
to build your app.
Then, just set a breakpoint and hit F5
in your Visual Studio Code.
Manual das variáveis de ambiente
Just run the command:
chmod +x ./start-dev.sh
./start-dev.sh
The application follows the Uncle Bob "Clean Architecture" principles and project structure :
.
├── /vscode/ # VSCode tasks, launch configuration and some
├── /commands/ # Commands specifics to be executed with nps
├── /dist/ # Compiled source files will be placed here
├── /docs/ # Docs of project
├── /postman/ # API documentation (POSTMAN)
├── /scripts/ # Database scripts seed/migrations
├── /src/ # Node.js application source files
│ ├── /constants/ # Constants of app
│ | ├── types.ts # types to dependency injection
│ ├── /domain/ # Enterprise core business layer
│ | ├── /entities/ # Domain model objects such as Entities, Aggregates, Value Objects, Business Events, etc.
│ | ├── /services/ # Domain services
│ | ├── /usecases/ # Application business rules
│ ├── /infra/ # Frameworks, drivers and tools such as Database, the Web Framework and etc
│ | ├── /api/ # Api config
│ | | ├── /logging/ # Api Logging
│ | | ├── /ControllerLoader.ts # Loader of controllers and routes
│ | | ├── /router.ts # Config router and middlewares
│ | | ├── /Server.ts # Server abstraction
│ | ├── /auth/ # Auth config
│ | ├── /console/ # Console config
│ | ├── /database/ # Database driver config
│ | | ├── /migrations/ # Database migration scripts
│ | | ├── /models/ # Sequelize Models
│ | | ├── /seeds/ # Seeds to create some data in the database
│ | | ├── /index.ts # index to database
│ | | ├── /ModelsLoader.ts # Loader of Sequelize Models
│ | | ├── /validator.ts # validator db types
│ | ├── /environment/ # environment abstraction
│ | ├── /fileStorage/ # FileStorage config
│ | ├── /internalApis/ # Internal Apis config
│ | ├── /logging/ # Logger of app config
│ | ├── /mailer/ # Mailer config
│ | | ├── /emails/ # Email templates
│ | | ├── /emailTemplates.ts # Constantes to email tempaltes
│ | ├── /siscof/ # Siscof adapter config
│ ├── /interfaces/ # Adapters and formatters for use cases and entities to external agency such as Db or Web
│ | ├── /rest/ # Rest adapter
│ | | ├── /controllers/ # API Controllers
│ | | ├── /errors/ # Custom HttpErrors like 404 NotFound
│ | | ├── /middlewares/ # Express Middlewares like authorization features
│ | | ├── Controller.ts # Controller interface
│ ├── /types/ # Custom type definitions and files that aren't on DefinitelyTyped
│ | | ├── express-request.d.ts # Custom type definition to express
│ | | ├── json.d.ts # Custom type definition to json extension
│ | | ├── sequelize-database.d.ts # Custom type definition to sequelize
│ ├── /Application.ts # Application services
│ ├── /config.ts # Global config app based in envs
│ ├── /container.ts # Dependecy Injection Container config with inversify
│ ├── /index.ts # bootstrap of app
├── /test # Tests
│ ├── /e2e/ # End-2-End tests (like e2e)
│ ├── /integration/ # Integration test with postgres
│ ├── /support/ # Support to tests (like database, logging mocks)
│ ├── /unit/ # Unit tests
├── .dockerignore # Defines Docker ignore folder, files and etc
├── .editorconfig # Editorconfig custom configrations
├── .env.example # Environment configurations
├── .gitignore # Defines git ignore folder, files and etc
├── .prettierignore # Defines prettier ignore folder, files and etc
├── .prettierrc # Prettier configuration
├── commitlint.config.js # Commitlint config
├── docker-compose.yml # Defines Docker services, networks and volumes
├── docker-compose-dev.yml # Defines Docker services, networks and volumes to development env
├── Dockerfile # Commands for building a Docker image for production
├── package-scripts.js # Package Scripts to app
├── package.json # List of project dependencies
├── start-dev.sh # Script to run image app with docker
├── tsconfig.json # Ttpescript configuration to build
├── tslint.json # TSLint configuration
More info about releases you find in Changelog
- Front-End — Front-End repository (www
- Integration — Integration gateway
- Deply (GMUD) — Deploy GMUD
Please read CONTRIBUTORS.md for details on our code of conduct, and the process for submitting pull requests to us.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
Made with ♥ by ITLAB (http://www.itlab.com.br)