zmts/supra-api-nodejs
zmts/supra-api-nodejs has 345 GitHub stars and 93 forks. Star changes are not measured yet. Last checked 2026-11-14 02:10 UTC. Last push 2023-03-04.
What you can do
- Modular RESTful API
- SQL based (PostgreSQL with objection.js)
- Migrations(knex.js)
- Auth (JWT/Access-token/Refresh-token)
Measured star growth
- in 24h
- Collecting history
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
About
❤️ Node.js REST API boilerplate. Old but still good for references
DataREADME.md
OriginalNode.js API boilerplate
Piece of my thoughts about Node.js architecture.
supra-api-nodejs: A little bit about Node.js RESTful APIs Architecture (RU)
Highlights:
- Modular RESTful API
- ES6 Classes
- Action based
- SQL based (PostgreSQL with objection.js)
- Migrations(knex.js)
- Auth (JWT/Access-token/Refresh-token)
- Cookie support
- Role based access control
- Request validation
- CRUD(users, posts resources)
- Automated API documentation
- Full authentication/authorization and user registration flow implemented
- Tests(e2e)
Key points:
0. Monolith first
Supra-api-nodejs its about monolith first approach. But this does not prevent you from using it in a microservice architecture as well.
1. Controller layer
Each entity have own controller class it slim layer representing resource mapping(routing)
class PostsController extends BaseController {
static get router () {
router.get('/', this.actionRunner(actions.ListAction))
router.get('/:id', this.actionRunner(actions.GetByIdAction))
router.post('/', this.actionRunner(actions.CreateAction))
router.patch('/:id', this.actionRunner(actions.UpdateAction))
router.delete('/:id', this.actionRunner(actions.RemoveAction))
return router
}
}
For example PostsController implements post entity routes. Each route fires own action.
2. Action layer
It's a class encapsulated request validation, permission verification and business logic. One file, one class, one REST operation, one use case.
3. DAO layer
Implement data access methods.
4. Model layer
Represent models schemas and validation rules. There is no other logic only model fields and validation rules.
Development:
Install global dependencies:
npm i -g knex nodemon
Setup database:
- Install PostgreSQL (https://postgresapp.com/downloads.html (for Mac OS))
- Create some DB (https://eggerapps.at/postico/ (for Mac OS))
Go ahead...
cd /supra-api-nodejs
cp .env.example .env- Set required credential in
.env
Run migration to set base SQL schema
knex migrate:latest
Run server
npm run start // prod mode
npm run dev // dev mode
Implemented endpoints:
/auth
| Path | Method | Description |
|---|---|---|
| /auth/login | POST | LoginAction |
| /auth/logout | POST | LogoutAction |
| /auth/refresh-tokens | POST | RefreshTokensAction |
/users
| Path | Method | Description |
|---|---|---|
| /users | GET | ListUsersAction |
| /users/current | GET | GetCurrentUserAction |
| /users/:id | GET | GetUserByIdAction |
| /users | POST | CreateUserAction |
| /users | PATCH | UpdateUserAction |
| /users/:id | DELETE | RemoveUserAction |
| /users/change-password | POST | ChangePasswordAction |
| /users/send-reset-password-email | POST | SendResetPasswordEmailAction |
| /users/reset-password | POST | ResetPasswordAction |
| /users/confirm-registration | POST | ConfirmRegistrationAction |
| /users/change-email | POST | ChangeEmailAction |
| /users/confirm-email | POST | ConfirmEmailAction |
| /users/resend-confirm-new-email-token | POST | ResendConfirmNewEmailTokenAction |
| /users/cancel-email-changing | POST | CancelEmailChangingAction |
/posts
| Path | Method | Description |
|---|---|---|
| /posts | GET | ListPostsAction |
| /posts | POST | CreatePostAction |
| /posts/:id | GET | GetPostByIdAction |
| /posts/:id | PATCH | UpdatePostAction |
| /posts/:id | DELETE | RemovePostAction |
!!! Project still in progress !!!
2017 - 2018 - 2019 - 2020 ...
Explore related projects
Asabeneh/30-Days-Of-Python
The 30 Days of Python programming challenge is a step-by-step guide to learn the Python programming language in 30 days. This challenge may take more than 100 days. Follow your own pace. These videos may help too: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,711 starsgrafana/grafana
The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
77,894 starsredis/redis
For developers, who are building real-time data-driven applications, Redis is the preferred, fastest, and most feature-rich cache, data structure server, and document and vector query engine.
77,490 starsapache/superset
Apache Superset is a Data Visualization and Data Exploration Platform
75,522 stars