Prerequisites
Before you begin, ensure you have the following software installed on your system:
- Git: For cloning the repository.
- Bun: As the primary package manager and JavaScript runtime.
- Docker and Docker Compose: For running the PostgreSQL database and other potential services in a containerized environment.
Installation
-
Clone the Repository
Open your terminal and clone the Yukinu repository to your local machine:
git clone https://github.com/tiesen243/yukinu.git cd yukinu -
Install Dependencies
This project uses a
bunfig.tomlfile to configure the workspace and ensure dependencies are hoisted to the rootnode_modulesdirectory. Simply run the following command from the root of the project to install all necessary packages for all applications and libraries:bun install
Environment Variables
The project relies on environment variables for configuration. A starter example file is provided at .env.example.
-
Create the
.envfile:Copy the example file to create your local configuration:
cp .env.example .env -
Populate the
.envfile:Open the newly created
.envfile and fill in the values. For local development, you primarily need to configure the database and generate anAUTH_SECRET.The database connection is configured using several
POSTGRES_*variables:Variable Description Default for Local Dev POSTGRES_HOSTThe database server hostname. 127.0.0.1POSTGRES_PORTThe port the database is on. 5432POSTGRES_USERThe database username. yukinuPOSTGRES_PASSWORDThe database password. MUST BE SETPOSTGRES_DATABASEThe name of the database. dbOther important variables include:
Variable Description How to Get AUTH_SECRETA secret key for NextAuth.js to sign JWTs. Run openssl rand -base64 32in your terminal.RESEND_TOKENAPI key for the Resend email service. From your Resend account dashboard. UPLOADTHING_TOKENAPI key for UploadThing file service. From your UploadThing account dashboard. Note: The
AUTH_FACEBOOK_andAUTH_GOOGLE_variables are optional and only needed if you intend to test social OAuth providers.
Running the Project
The root package.json file contains a number of scripts to simplify the development workflow.
-
Start the Database:
This command starts the PostgreSQL container in detached mode using Docker Compose.
bun run db:start -
Apply the Database Schema:
Once the container is running, you need to apply the Prisma schema to the database.
bun run db:push -
Start All Applications:
To run all applications (web, dashboard, etc.) simultaneously in development mode, use the following command:
bun run devThis uses
turbo devto start all workspace applications, and they will be accessible on different local ports (e.g.,http://localhost:3000andhttp://localhost:3001).
Troubleshooting
- Database Connection Errors: If you are unable to connect to the database, ensure that your Docker container is running (
docker ps). Also, double-check that theDATABASE_URLin your.envfile exactly matches the user, password, and port configured indocker-compose.yml. - “Port is already in use” error: This means another application is using the port that one of the Next.js apps is trying to use. You can either stop the other application or change the port in the
package.jsonfor the respective app (apps/weborapps/dashboard).