Skip to content

Mkrsun/webdojo-backend-ts-expressjs

Repository files navigation

Here's a README.md file for your Express.js TypeScript project:

README.md

# 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
   ```
  1. Install dependencies:

    npm install
  2. 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

Running the Application

  1. Start the application:

    npm start
  2. The server should now be running at http://localhost:3000.

Running Tests

  1. Run the tests:

    npm test

Database Migrations and Seeds

  1. Create the database:

    npm run db:create
  2. Run migrations:

    npm run migration:lts
  3. Seed the database:

    npm run seed:all

Docker Commands

  1. Create the database in Docker:

    npm run docker:db:create
  2. Create a new migration in Docker:

    npm run docker:db:migration:new
  3. Run migrations in Docker:

    npm run docker:db:migration:lts
  4. Run seeds in Docker:

    npm run docker:db:seed:all

Project Structure

.
├── 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

Dependencies

  • 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.

Dev Dependencies

  • @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.

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

License

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.

About

Backend for Web Dojo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published