# Getting Started

**2.1. Prerequisites**

Before you begin, ensure you have the following software installed on your system. Please use the recommended versions to avoid potential compatibility issues.

* Node.js: (v18.0 or higher) - For running the Next.js frontend.
* Rust: (Latest stable version) - For compiling and running the backend service.
* Docker and Docker Compose: (Latest versions) - For a containerized deployment.
* PostgreSQL: (v14 or higher) - As the primary database for the application.

**2.2. Installation and Setup**

Follow these steps to get the project running on your local machine.

1. Clone the Repository: Open your terminal and clone the project from GitHub:

```
git clone https://github.com/neutron420/compiler
cd your-repository
```

2. Backend Configuration (Rust Service):The backend is a high-performance Rust application.

* Navigate to the Backend Directory:

```
cd compiler
```

Build the Project:Compile the Rust application using Cargo. This will download all the necessary dependencies.

```
cargo build
```

3. Frontend Configuration (Next.js Web App): The frontend is a modern web application built with Next.js.

* Navigate to the Frontend Directory:

```
cd web
```

Install Dependencies: Use `npm` to install all the required packages.

```
npm install
```

4. Database Setup (PostgreSQL): The application uses a PostgreSQL database to store data.

* Create a `.env` File: In the root of the project, create a `.env` file and add your database connection URL:

```
DATABASE_URL="postgresql://user:password@localhost:5432/mydatabase"
```

Run Database Migrations:\
Use Prisma to apply the database schema.

```
npx prisma migrate dev
```

**2.3. Running the Application**

Once the setup is complete, you can run the application using one of the following methods:

* Using Docker Compose (Recommended): From the root of the project, run the following command to start all services:

```
docker-compose up -d
```

Running Services Individually:

* Start the Backend:

```
cd rust_compiler
cargo run
```

Start the Frontend:

```
cd web
npm run dev
```
