GeekyAnts/express-typescript-postgres(opens in a new tab)
Language: TypeScript
An API Boilerplate for Node.js, Express.js & PostgresSQL.
- stars
- 130
- watchers
- 7
- forks
- 44
- open issues
- 0
- Last updated
- 02/01/2026
Language: TypeScript
An API Boilerplate for Node.js, Express.js & PostgresSQL.
An API Boilerplate for Node.js, Express.js & PostgresSQL
Here's few of the challenges we faced while working on an enterprise applications;
We came up with express-typescript-postgress, this repository solves all the above mentioned problems as well as the things beyond that! Here's the list of few things we've accomplished;
and many more...
API boilerplate by GeekyAnts.
Services:
| Binaries | Version |
|---|---|
| NodeJS | >= LTS |
| NPM | >= 6.14.6 |
| PostgreSQL | >= 12.1 |
| ts-node-dev | >= 1.0.0 |
├── config │ └── index.sample.ts ├── database │ ├── migrations │ ├── seeders │ └── snapshots ├── src │ ├── controllers │ │ ├── app.ts │ │ ├── auth.ts │ │ ├── index.ts │ │ └── user.ts │ ├── db_pool │ │ ├── auto_schema.ts │ │ ├── helper.ts │ │ ├── pg_pool.ts │ │ └── schema.ts │ ├── events │ │ ├── listeners │ │ │ └── auth_listener.ts │ │ └── index.ts │ ├── helpers │ │ ├── exception_wrapper.ts │ │ ├── file.ts │ │ ├── index.ts │ │ ├── notfound_handler.ts │ │ ├── random_string.ts │ │ └── upload.ts │ ├── middlewares │ │ ├── check_auth.ts │ │ └── schema.ts │ ├── models │ │ ├── auth.ts │ │ ├── common.ts │ │ ├── index.ts │ │ ├── log.ts │ │ ├── user_login.ts │ │ └── user.ts │ ├── providers │ │ ├── cors.ts │ │ ├── logger.ts │ │ └── version.ts │ ├── routes │ │ ├── app │ │ │ ├── index.ts │ │ │ └── schema.ts │ │ ├── auth │ │ │ ├── index.ts │ │ │ └── schema.ts │ │ ├── user │ │ │ ├── index.ts │ │ │ └── schema.ts │ │ └── index.ts │ ├── services │ │ ├── common_service.ts │ │ ├── email_service.ts │ │ ├── index.ts │ │ ├── log_service.ts │ │ └── user_service.ts │ ├── swagger │ │ ├── backend_api.yaml │ │ └── index.ts │ ├── typings │ │ ├── interface.ts │ │ └── types.ts │ ├── validators │ │ ├── auth.ts │ │ └── user.ts │ ├── extractOpenAPI.ts │ ├── index.ts │ ├── package.json │ ├── prettier.config.js │ └── tsconfig.json ├── .gitignore └── README.md
# Clone the repository git clone # Create the config file from the sample-config file cp config/index.sample.ts config/index.ts; # Add your database details user: 'db_username', password: 'db_password', database: 'db_dbname', host: 'db_host', # Goto the source code cd src; # Install NPM dependencies npm install; # Map new-migration command sudo npm link;
To ensure consitency of database across every system that uses this boilerplate code we use in house logic and auto update functions to maintain our migrations and snapshots.
database/migrations folder with .sql extension defining any SQL operation (UPDATE/CREATE/DROP/INSERT).new-migration
database/snapshots folder you fill find all the tables with defined structure and views that are there in your connected database.Go to file PostgresFunctions.md for detailed explanation of various functions we have used.
Go to file Inheritance.md for the explanation on use of inheritance.
| Auth | User | App |
|---|---|---|
/auth/login |
/user |
/app/version |
/auth/forgot-password |
/user/add |
|
/auth/change-password |
/user/roles |
|
/auth/whoami |
/user/{id_user} |
|
auth/refresh-token |
/user/{id_user} |
cd src/ npm run dev;
cd src/ npm run prod;
<HOST>:<PORT>/swagger