Changeset 5a1bf39
- Timestamp:
- 12/27/25 15:15:29 (7 months ago)
- Branches:
- main
- Children:
- fc8a8b1
- Parents:
- 5750945
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
README.md
r5750945 r5a1bf39 1 Generated with [vike.dev/new](https://vike.dev/new) ([version 544](https://www.npmjs.com/package/create-vike/v/0.0.544)) using this command: 1 # PC Forge 2 2 3 ```sh 4 npm create vike@latest --- --react --authjs --telefunc --hono --drizzle --biome 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 5 35 ``` 6 36 7 ## Contents37 ### 2. Configure Environment 8 38 9 - [Vike](#vike) 10 - [Plus files](#plus-files) 11 - [Routing](#routing) 12 - [SSR](#ssr) 13 - [HTML Streaming](#html-streaming) 14 - [Photon](#photon) 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`). 15 50 16 ## Vike 51 ### 3. Start with Docker 52 ```agsl 53 docker compose up --build 54 ``` 17 55 18 This app is ready to start. It's powered by [Vike](https://vike.dev) and [React](https://react.dev/learn). 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** 19 61 20 ### Plus files 62 **Access the application at: http://localhost:8080** 21 63 22 [The + files are the interface](https://vike.dev/config) between Vike and your code. 64 ## ⚙️ Pre-configured Settings 23 65 24 - [`+config.ts`](https://vike.dev/settings) — Settings (e.g. `<title>`) 25 - [`+Page.tsx`](https://vike.dev/Page) — The `<Page>` component 26 - [`+data.ts`](https://vike.dev/data) — Fetching data (for your `<Page>` component) 27 - [`+Layout.tsx`](https://vike.dev/Layout) — The `<Layout>` component (wraps your `<Page>` components) 28 - [`+Head.tsx`](https://vike.dev/Head) - Sets `<head>` tags 29 - [`/pages/_error/+Page.tsx`](https://vike.dev/error-page) — The error page (rendered when an error occurs) 30 - [`+onPageTransitionStart.ts`](https://vike.dev/onPageTransitionStart) and `+onPageTransitionEnd.ts` — For page transition animations 66 The following settings are pre-configured for Docker and should **not** be changed unless you know what you're doing: 31 67 32 ### Routing 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` 33 74 34 [Vike's built-in router](https://vike.dev/routing) lets you choose between: 75 ## 💻 Development 35 76 36 - [Filesystem Routing](https://vike.dev/filesystem-routing) (the URL of a page is determined based on where its `+Page.jsx` file is located on the filesystem) 37 - [Route Strings](https://vike.dev/route-string) 38 - [Route Functions](https://vike.dev/route-function) 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 ``` 39 90 40 ### SSR 91 **Seed database** 92 ```agsl 93 npm run drizzle:seed 94 ``` 41 95 42 SSR is enabled by default. You can [disable it](https://vike.dev/ssr) for all or specific pages. 96 **Start development server** 97 ```agsl 98 npm run dev 99 ``` 43 100 44 ### HTML Streaming 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 ``` 45 121 46 You can [enable/disable HTML streaming](https://vike.dev/stream) for all or specific pages.47 122 48 ## Photon123 ## 👥 Default Users 49 124 50 [Photon](https://photonjs.dev) is a next-generation infrastructure for deploying JavaScript servers. 125 After the database is seeded, you can log in with these accounts: 51 126 52 See [Introducing Photon](https://vike.dev/blog/photon) and [Why Photon](https://photonjs.dev/why) to learn more. 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 | 53 140 141 ## 🔧 Environment Variables 142 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) | 148 149 # 📚 Course Information 150 151 This project was developed for the Databases 2025/26 course. It demonstrates: 152 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 158 159 # 📄 License 160 161 MIT License
Note:
See TracChangeset
for help on using the changeset viewer.
