Here's a README.md
file for your Express.js TypeScript project:
# E-Learning SaaS Platform Backend
This is the backend for an E-Learning SaaS platform designed to provide hands-on experience for frontend, backend, and full-stack software developers. The platform allows users to work on dummy and real projects, receive mentorship, and get paid for successfully completing real projects.
## Getting Started
### Prerequisites
- Node.js
- Docker (optional, for running database in a container)
### Installation
1. Clone the repository:
```sh
git clone https://github.com/your-repo/backend.git
cd backend
```
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory with the following content:PORT=3000 DB_HOST=localhost DB_USER=root DB_PASSWORD=password DB_NAME=elearning DB_PORT=3306
-
Start the application:
npm start
-
The server should now be running at
http://localhost:3000
.
-
Run the tests:
npm test
-
Create the database:
npm run db:create
-
Run migrations:
npm run migration:lts
-
Seed the database:
npm run seed:all
-
Create the database in Docker:
npm run docker:db:create
-
Create a new migration in Docker:
npm run docker:db:migration:new
-
Run migrations in Docker:
npm run docker:db:migration:lts
-
Run seeds in Docker:
npm run docker:db:seed:all
.
├── src
│ ├── controllers
│ │ └── auth.controller.ts
│ ├── db
│ │ ├── mysql
│ │ │ ├── mysql.pool.ts
│ │ │ └── mysql.repository.ts
│ ├── middleware
│ │ └── errorHandler.ts
│ ├── repositories
│ │ ├── auth.repository.ts
│ │ └── mysql.repository.ts
│ ├── scripts
│ │ ├── createDb.js
│ │ ├── createMigration.mjs
│ │ └── createSeed.mjs
│ ├── services
│ │ └── auth.service.ts
│ ├── utils
│ │ ├── validator
│ │ │ ├── isValidEmail.ts
│ │ │ ├── isStrongPassword.ts
│ │ │ └── hashPassword.ts
│ └── server.ts
├── jest.config.ts
├── knexfile.ts
└── tsconfig.json
- bcrypt: For hashing passwords.
- cookie-parser: For parsing cookies.
- dotenv: For environment variable management.
- express: Web framework for Node.js.
- knex: SQL query builder.
- mysql2: MySQL client for Node.js.
- morgan: HTTP request logger.
- @types/*: TypeScript definitions for various packages.
- inquirer: For interactive CLI prompts.
- jest: Testing framework.
- ts-jest: TypeScript preprocessor for Jest.
- ts-node: TypeScript execution environment for Node.js.
- Fork the repository
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This `README.md` file provides a comprehensive overview of your project, including installation steps, running the application, testing, database migrations and seeds, project structure, dependencies, and contribution guidelines.