A web-socket service and API built with Node.JS, Express and Socket.IO.
-
🏃 Node.js: A JavaScript runtime built on Chrome's V8 JavaScript engine, designed for building scalable network applications.
-
🔌 Socket.IO A web-socket server framework for the Node runtime.
-
🔐 Auth0 API routes protected with JWT's with authentication provided by Auth0.
-
🥽 TypeScript: A superset of JavaScript that adds static typing, enabling a more robust development experience and improved code quality.
-
🍔 Express: A fast, unopinionated, minimalist web framework for Node.js, designed for building web and mobile applications.
-
🌦️ Drizzle ORM: A lightweight ORM library for Node.js, providing a convenient way to interact with Postgres databases.
-
🤡 Jest and Supertest: Jest is a JavaScript testing framework with a focus on simplicity. Supertest is a library for testing HTTP assertions with Jest.
-
Clone the repository:
git clone https://github.com/your-username/your-project.git cd your-project
-
Install dependencies:
npm install
-
Configure the Database:
Create a
.env
file in the project root and update with the following:NODE_ENV=development PORT=3000 CONNECTION_STRING=postgres://{user}:{pass}@{host}:{port}/{database} SESSION_SECRET=TEMP_SECRET TEST_USER_PASSWORD=password123
-
Run Migrations:
Run the database migrations to set up the initial schema.
npm run migrations
-
Start the Development Server:
npm run dev
The server will be running at
http://localhost:3000
.
-
npm run dev
: Start the development server with automatic reload on code changes. -
npm run start
: Start the production server. -
npm run test
: Run Jest tests. -
npm run db-studio
: Start the Drizzle Kit studio. -
npm run migrations
: Run database migrations.
your-project/
|-- src/
| |-- controllers/ # Express route controllers
| |-- db/ # Database configuration and migrations
| |-- middleware/ # Express middleware
| |-- routes/ # Express routes
| |-- app.ts # Express app setup
|-- tests/ # Jest test files
|-- .babelrc # Babel configuration (for Jest)
|-- .eslintrc.json # ESLint configuration
|-- jest.config.js # Jest configuration
|-- package.json # Project dependencies and scripts
|-- tsconfig.json # TypeScript configuration
|-- README.md # Project documentation
Jest and Supertest are used for testing. Write your tests in the tests
directory and run them with npm run test
.
npm run test
Feel free to contribute to this starter template. Create issues, fork the repository, and submit pull requests. Your feedback and contributions are highly appreciated!
This project is licensed under the MIT License - see the LICENSE file for details.