Skip to main content

Setup Environment

This tutorial will guide you through setting up your development environment for Bellamy Book.

Prerequisites​

Before starting, ensure you have:

  • Node.js v16.14 or higher
  • .NET SDK 6.0 or higher
  • Docker and Docker Compose (optional)
  • PostgreSQL 12 or higher
  • MongoDB 4.4 or higher
  • Redis 6.0 or higher

Step 1: Clone the Repository​

git clone https://github.com/nmtri3108/BellamyBook-Official.git
cd bellamy-book

Step 2: Setup Backend​

Install Dependencies​

cd Src/backend
dotnet restore

Configure Database​

  1. Update appsettings.json:
{
"ConnectionStrings": {
"PostgreSQL": "Host=localhost;Database=bellamybook;Username=postgres;Password=password",
"MongoDB": "mongodb://localhost:27017",
"Redis": "localhost:6379"
}
}

Run Migrations​

dotnet ef database update --project DatabaseApplication

Start Backend​

dotnet run --project API

Backend should be running on http://localhost:5000

Step 3: Setup Frontend​

Install Dependencies​

cd Src/frontend
npm install

Configure Environment​

Create .env file:

VITE_API_URL=http://localhost:5000
VITE_WS_URL=ws://localhost:5000

Start Frontend​

npm run dev

Frontend should be running on http://localhost:3000

Step 4: Setup Admin Panel​

Install Dependencies​

cd Src/admin
npm install

Start Admin Panel​

npm run dev

Admin panel should be running on http://localhost:3001

Step 5: Verify Installation​

  1. Open http://localhost:3000 in your browser
  2. Register a new account
  3. Create a test post
  4. Verify everything works

Using Docker Compose​

Alternatively, use Docker Compose for easier setup:

cd dockerLocalENV
docker-compose up -d

This starts all services automatically.

Troubleshooting​

Port Already in Use​

If ports are already in use, update:

  • Backend: appsettings.json
  • Frontend: .env file
  • Admin: .env file

Database Connection Issues​

  • Verify PostgreSQL is running
  • Check connection strings
  • Ensure databases exist

MongoDB Connection Issues​

  • Verify MongoDB is running
  • Check connection string format

Next Steps​