Welcome to the Collabberry Backend repository! This document serves as a guide for setting up and running the backend server for Collabberry.
Before getting started, ensure you have Node.js and Yarn installed on your machine. You can download Node.js from here and follow the instructions for your operating system. Yarn can be installed by following the instructions on the official website: Yarn Installation Guide.
Once Node.js and Yarn are installed, follow these steps:
-
Clone this repository to your local machine:
git clone <repository-url>
-
Navigate into the project directory:
cd backend
-
Install project dependencies using Yarn:
yarn install
The project uses environment variables for configuration. Create a .env
file in the root directory of the project and configure it with the required environment variables. Here's an example of how it might look:
PORT=3000
Replace with your actual database credentials.
To run the backend server, you can use the following commands:
-
Production Mode:
yarn start
This command compiles TypeScript files to JavaScript using the TypeScript compiler (
tsc
) and then runs the compiled JavaScript file. -
Development Mode:
yarn dev
This command uses
ts-node-dev
to run the TypeScript files directly, enabling automatic restarts when files are changed. It's recommended for development purposes.
The project's file structure is organized as follows:
- src/services: Contains service modules responsible for handling business logic.
- src/entities: Holds entity classes for defining database tables using TypeORM for MSSQL database.
- src/controllers: Contains controller modules responsible for handling incoming requests and returning responses.
- src/routers: Defines the API routes using Express.js.
- Make sure to install all dependencies listed in
package.json
usingyarn install
before running the project. - Ensure that your TypeScript and Node.js versions are compatible with the dependencies listed in
package.json
.