This is a template for Node.js projects. The template includes configuration for TypeScript, ESLint, Prettier, testing with Jest, and CI/CD with GitHub Actions.
- Node.js (v20+ recommended)
- npm
- Clone the repository:
git clone <repository-url> cd express-ts-ddd
- Install dependencies:
npm install
- Create a .env file at the root of your project. Add the necessary environment variables
- Run the development server:
npm run start:dev
- Build the project:
npm run build
- Lint the code:
npm run lint
- Automatically fix linting issues:
npm run lint:fix
- Format the code with Prettier:
npm run format
The project uses Husky for pre-commit hooks to enforce standards before code is committed. Linting and testing are automatically run before each commit.
To enforce Conventional Commits, the project uses Commitlint.
A GitHub Actions workflow is configured to run linting and tests automatically on each pull request to the main branch. The workflow file is located at .github/workflows/LintAndTestWorkflow.yml
.
├── .github/
├── .husky/
├── src # Source code folder
│ ├── config.ts # Configuration management
│ ├── index.ts # Entry point
│ └── ... # Other modules
├── tests/ # Unit and integration tests
├── .commitlintrc.json # Commitlint configuration
├── .env.sample # Example of environment variables file
├── .gitignore # Git ignore rules
├── .prettierignore # Prettier ignore rules
├── .prettierrc # Prettier configuration
├── eslint.config.mjs # ESLint configuration
├── jest.config.js # Jest configuration
├── nodemon.json # Nodemon configuration
├── package.json # Project metadata and npm scripts
├── package-lock.json # Auto-generated file for dependencies
├── README.md # Project README
├── tsconfig.json # TypeScript configuration
To contribute to this project:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature
). - Make your changes and commit them (
git commit -m 'feat: add new feature'
). - Push to the branch (
git push origin feature/your-feature
). - Open a pull request.
This project is licensed under the MIT License.