Skip to content

Getting Started

gurshan edited this page Oct 16, 2024 · 9 revisions

Setup

Cloning the Repository

Install git and clone the repo:

git clone https://github.com/SCE-Development/spartan-compass/

Installing bun

  • I recommend using bun for faster installations and efficient disk space usage compared to npm.

  • Install bun with this command:

# Unix
curl -fsSL https://bun.sh/install | bash

# Windows
powershell -c "irm bun.sh/install.ps1 | iex"

Running the Database

  1. Install Docker:
  1. Start the local databases with:
bun run db:start
  1. Setup RedisInsight:

Once your containers are ready, visit http://localhost:5540/ and accept the terms of service.

Then, click Add Redis Database on the top left, and enter redis for the host and 6379 for the port.

Once you've done this, you should be able to preview what our redis instance looks like.

CleanShot 2024-10-14 at 16 58 02

Setting up Environment Variables

To connect to the local database instance, you need to create a .env file with the appropriate DATABASE_URL.

  1. Create a .env file in your project root:
touch .env
  1. Open the .env file and update the DATABASE_URL value to point to your local database instance as well as our REDIS_URL:
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
REDIS_URL="redis://localhost:6379"

Warning

Only do the third step after the Tutorial - Implementing a Complete Feature

  1. Generate and run our database migrations on our local db and optionally seed it for sample data:
bun run db:generate
bun run db:migrate
bun run db:seed

Running the Application

To start the application, you first need to install the dependencies with:

bun install

Then, start the application with:

bun dev

Congrats! If you reached this step, everything should be working. If you had any issues, feel free to post them in the dev team channel.

At this point, you should move on to Tutorial - Implementing a Complete Feature.