Skip to content

A pre-configured Node.js boilerplate with TypeScript, Express and PostgreSQL, plus settings for popular tools like ESLint, Prettier, and Husky. Comes with a pre-defined file structure and ready-to-use libraries like Zod, JWT, Bcrypt and Helmet. Highly customizable to meet your needs.

License

guilhiz/Node-Boilerplate

Repository files navigation

My Node Boilerplate with TypeScript

⚙️ Configs

  • 🔄 Dependabot — Automated dependency updates for GitHub repositories.
  • 💠 Express — Fast, flexible web framework for Node.js
  • 🗃️ Prisma — A modern database ORM
  • TSX — Node.js library with esbuild to run TypeScript & ESM files
  • TSUP — A fast and flexible TypeScript building tool
  • 📁 Dotenv-cli — To load multiple environment variables files
  • 🔧 ESLint — Pluggable JavaScript linter
  • 🎨 Prettier — Opinionated Code Formatter
  • 📝 Commitzen — Git commit message helper
  • 🐶 Husky — Use git hooks with ease
  • 🚫 Lint-staged — Run linters against staged git files

Libs

  • 🔒 Zod — TypeScript-first schema validation.
  • 🔑 JWT — JSON Web Token implementation.
  • 🔬 Jest — A popular JavaScript testing framework
  • 🔐 Bcrypt — Library for hashing passwords.
  • 🛡️ Helmet — Express middleware for securing HTTP headers.
  • ✂️ Saniteze-html — Remove HTML tags from a string.

🚀 Getting Started

To use this boilerplate as a template for your own project, follow these steps:

  • Click on the Use this template button on this repository page to create a new repository from this template.
  • Choose a name and configure the new repository as desired.
  • Clone the newly created repository to your local machine with the following command in your terminal:
git clone https://github.com/<YOUR_USERNAME>/<YOUR_PROJECT_NAME>.git

After cloning the repository, run the following commands inside the project folder:

  • Install the dependencies with npm install
  • Create an env.development file in the envs folder
  • Configure the environment variables based on the envs/.env.development.example
  • Run the project with npm run dev

📁 Main File Structure

├── 📁.github // GitHub workflows
├── 📁.husky // Git hooks
├── 📁.envs // Environment variables
├── 📁.prisma // Prisma ORM configuration
|
├── 📁src
|   ├── 📁configs // Application configurations
|   ├── 📁controllers // Request controllers
|   ├── 📁errors // Custom error classes
|   ├── 📁middlewares // Middleware functions
|   ├── 📁repositories // Data access layer
|   ├── 📁routes  // Application routes
|   ├── 📁schemas // Request schemas
|   ├── 📁services // Business logic layer
|   ├── 📁utils // General utilities
|   |   ├──📁constants // Global constants
|   |   └──📁functions // Utility functions
|   |
|   ├── 📄app.ts // Express app configuration
|   └── 📄server.ts // Server entry point
|
├── 📁tests
|   ├── 📁factories // Test data factories
|   ├── 📁integration // Integration tests
|   └── 📁unit // Unit tests
|
├── 📄.eslintrc.json // ESLint configuration file
├── 📄.prettierrc // Prettier configuration file
├── 📄jest.config.ts // Jest configuration file
├── 📄README.md // Project documentation
├── 📄package.json // NPM package configuration file
└── 📄tsconfig.json // TypeScript configuration file

:octocat: How to use commitzen

  1. Run git add to stage changes
  2. Run git commit without providing a message to use Commitzen
  3. Use the Commitzen interface to write and confirm the commit message
ezgif.com-gif-maker.mp4

🤝 Contributing

If you want to contribute to this template, follow these steps:

  • Fork this repository
  • Create a new branch with their feature using git checkout -b my-feature.
  • Commit their changes using git commit -m 'Adding new feature'.
  • Push the changes to their branch using git push origin my-feature.
  • Open a pull request on your repository.

About

A pre-configured Node.js boilerplate with TypeScript, Express and PostgreSQL, plus settings for popular tools like ESLint, Prettier, and Husky. Comes with a pre-defined file structure and ready-to-use libraries like Zod, JWT, Bcrypt and Helmet. Highly customizable to meet your needs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published