| [5a1bf39] | 1 | # PC Forge
|
|---|
| [8ee4553] | 2 |
|
|---|
| [5a1bf39] | 3 | **Forge your own PC build.** A web application for crafting, sharing, and rating custom PC builds. A project for the **Databases 2025/26** course.
|
|---|
| 4 |
|
|---|
| 5 | ## ✨ Features
|
|---|
| 6 |
|
|---|
| 7 | - 🔨 Forge custom PC builds from a comprehensive component database
|
|---|
| 8 | - 💾 Browse CPUs, GPUs, motherboards, storage, and more
|
|---|
| 9 | - ⭐ Rate and review community builds
|
|---|
| 10 | - 💬 Suggest new components for the database
|
|---|
| 11 | - 👤 User authentication and admin management
|
|---|
| 12 |
|
|---|
| 13 | ## 🛠️ Tech Stack
|
|---|
| 14 |
|
|---|
| 15 | - **Frontend**: React 19, Material-UI, Emotion
|
|---|
| 16 | - **Backend**: Hono, Node.js
|
|---|
| 17 | - **Database**: PostgreSQL 16
|
|---|
| 18 | - **ORM**: Drizzle ORM
|
|---|
| 19 | - **Build Tool**: Vite
|
|---|
| 20 | - **Containerization**: Docker & Docker Compose
|
|---|
| 21 |
|
|---|
| 22 | ## 📋 Prerequisites
|
|---|
| 23 |
|
|---|
| 24 | - [Docker Desktop](https://www.docker.com/products/docker-desktop) (latest version)
|
|---|
| 25 | - Docker Compose V2 (included with Docker Desktop)
|
|---|
| 26 | - [Node.js 20+](https://nodejs.org/) (optional, for local development)
|
|---|
| 27 | - [npm](https://www.npmjs.com/)
|
|---|
| 28 |
|
|---|
| 29 | ## 🚀 Quick Start
|
|---|
| 30 |
|
|---|
| 31 | ### 1. Clone the Repository
|
|---|
| 32 | ```agsl
|
|---|
| 33 | git clone https://github.com/nkvtd/pc-forge.git
|
|---|
| 34 | cd pc-forge
|
|---|
| [8ee4553] | 35 | ```
|
|---|
| 36 |
|
|---|
| [5a1bf39] | 37 | ### 2. Configure Environment
|
|---|
| 38 |
|
|---|
| 39 | **Copy the example environment file:**
|
|---|
| 40 | ```agsl
|
|---|
| 41 | cp .env.example .env
|
|---|
| 42 | ```
|
|---|
| 43 | **Update only the AUTH_SECRET in `.env`:**
|
|---|
| 44 | ```agsl
|
|---|
| 45 | DATABASE_URL="postgresql://app:app@db:5432/postgres"
|
|---|
| 46 | AUTH_SECRET="YOUR_GENERATED_SECRET_KEY_HERE"
|
|---|
| 47 | PORT=8080
|
|---|
| 48 | ```
|
|---|
| 49 | > **Important**: The `DATABASE_URL` and `PORT` are pre-configured for Docker. Only change the `AUTH_SECRET` to a random, secure value (you can generate one using `openssl rand -base64 32`).
|
|---|
| [8ee4553] | 50 |
|
|---|
| [5a1bf39] | 51 | ### 3. Start with Docker
|
|---|
| 52 | ```agsl
|
|---|
| 53 | docker compose up --build
|
|---|
| 54 | ```
|
|---|
| [8ee4553] | 55 |
|
|---|
| [5a1bf39] | 56 | The application will automatically:
|
|---|
| 57 | - ✅ Start PostgreSQL database on port **5432**
|
|---|
| 58 | - ✅ Run database migrations
|
|---|
| 59 | - ✅ Seed initial data (users, components, builds)
|
|---|
| 60 | - ✅ Start the web server on port **8080**
|
|---|
| [8ee4553] | 61 |
|
|---|
| [5a1bf39] | 62 | **Access the application at: http://localhost:8080**
|
|---|
| [8ee4553] | 63 |
|
|---|
| [5a1bf39] | 64 | ## ⚙️ Pre-configured Settings
|
|---|
| [8ee4553] | 65 |
|
|---|
| [5a1bf39] | 66 | The following settings are pre-configured for Docker and should **not** be changed unless you know what you're doing:
|
|---|
| [8ee4553] | 67 |
|
|---|
| [5a1bf39] | 68 | - **Database Host**: `db` (Docker service name)
|
|---|
| 69 | - **Database Port**: `5432`
|
|---|
| 70 | - **Database Name**: `postgres`
|
|---|
| 71 | - **Database User**: `app`
|
|---|
| 72 | - **Database Password**: `app`
|
|---|
| 73 | - **Application Port**: `8080`
|
|---|
| 74 |
|
|---|
| 75 | ## 💻 Development
|
|---|
| 76 |
|
|---|
| 77 | ### Local Development (Without Docker)
|
|---|
| 78 | **Install dependencies**
|
|---|
| 79 | ```agsl
|
|---|
| 80 | npm install
|
|---|
| 81 | ```
|
|---|
| 82 | **Update DATABASE_URL in .env to use localhost**
|
|---|
| 83 | ```agsl
|
|---|
| 84 | DATABASE_URL="postgresql://app:app@localhost:5432/postgres"
|
|---|
| 85 | ```
|
|---|
| 86 | **Run database migrations**
|
|---|
| 87 | ```agsl
|
|---|
| 88 | npm run drizzle:migrate
|
|---|
| 89 | ```
|
|---|
| 90 |
|
|---|
| 91 | **Seed database**
|
|---|
| 92 | ```agsl
|
|---|
| 93 | npm run drizzle:seed
|
|---|
| 94 | ```
|
|---|
| 95 |
|
|---|
| 96 | **Start development server**
|
|---|
| 97 | ```agsl
|
|---|
| 98 | npm run dev
|
|---|
| 99 | ```
|
|---|
| 100 |
|
|---|
| 101 | ## 📁 Project Structure
|
|---|
| 102 | ```agsl
|
|---|
| 103 | pc-forge/
|
|---|
| 104 | ├── database/
|
|---|
| 105 | │ └── drizzle/
|
|---|
| 106 | │ ├── schema/ # Database schema definitions
|
|---|
| 107 | │ ├── queries/ # Database queries
|
|---|
| 108 | │ └── util/
|
|---|
| 109 | │ └── seed.ts # Database seeding script
|
|---|
| 110 | ├── dist/ # Built application
|
|---|
| 111 | ├── migrations/ # Generated database migrations
|
|---|
| 112 | ├── pages/ # Vike pages
|
|---|
| 113 | ├── server/ # Backend server code
|
|---|
| 114 | ├── Dockerfile # Docker image configuration
|
|---|
| 115 | ├── docker-compose.yml # Docker services orchestration
|
|---|
| 116 | ├── docker-entrypoint.sh # Container startup script
|
|---|
| 117 | ├── drizzle.config.ts # Drizzle ORM configuration
|
|---|
| 118 | ├── .env.example # Example environment variables
|
|---|
| 119 | └── package.json
|
|---|
| 120 | ```
|
|---|
| [8ee4553] | 121 |
|
|---|
| 122 |
|
|---|
| [5a1bf39] | 123 | ## 👥 Default Users
|
|---|
| [8ee4553] | 124 |
|
|---|
| [5a1bf39] | 125 | After the database is seeded, you can log in with these accounts:
|
|---|
| [8ee4553] | 126 |
|
|---|
| [5a1bf39] | 127 | | Username | Password | Role |
|
|---|
| 128 | |----------|----------|------|
|
|---|
| 129 | | admin | admin | Admin |
|
|---|
| 130 | | tome | tg | User |
|
|---|
| 131 | | mihail | mn | User |
|
|---|
| 132 | | stefan | sv | User |
|
|---|
| 133 | | pc_wizard | pw | User |
|
|---|
| 134 | | budget_king | bk | User |
|
|---|
| 135 | | rgb_lover | rgb | User |
|
|---|
| 136 | | streamer_pro | sp | User |
|
|---|
| 137 | | office_guy | og | User |
|
|---|
| 138 | | linux_fan | lf | User |
|
|---|
| 139 | | first_timer | ft | User |
|
|---|
| [8ee4553] | 140 |
|
|---|
| [5a1bf39] | 141 | ## 🔧 Environment Variables
|
|---|
| [8ee4553] | 142 |
|
|---|
| [5a1bf39] | 143 | | Variable | Description | Default | Should Change? |
|
|---|
| 144 | |----------|-------------|---------|----------------|
|
|---|
| 145 | | `DATABASE_URL` | PostgreSQL connection string | `postgresql://app:app@db:5432/postgres` | ❌ No (pre-configured) |
|
|---|
| 146 | | `AUTH_SECRET` | Authentication secret key | - | ✅ **Yes (required)** |
|
|---|
| 147 | | `PORT` | Application port | `8080` | ❌ No (pre-configured) |
|
|---|
| [8ee4553] | 148 |
|
|---|
| [5a1bf39] | 149 | # 📚 Course Information
|
|---|
| [8ee4553] | 150 |
|
|---|
| [5a1bf39] | 151 | This project was developed for the Databases 2025/26 course. It demonstrates:
|
|---|
| [8ee4553] | 152 |
|
|---|
| [5a1bf39] | 153 | - Complex relational database design with PostgreSQL
|
|---|
| 154 | - Database migrations and seeding
|
|---|
| 155 | - ORM usage (Drizzle ORM)
|
|---|
| 156 | - Full-stack web application development
|
|---|
| 157 | - Containerization with Docker
|
|---|
| [8ee4553] | 158 |
|
|---|
| [5a1bf39] | 159 | # 📄 License
|
|---|
| [8ee4553] | 160 |
|
|---|
| [5a1bf39] | 161 | MIT License
|
|---|