|
1 | | -# PastExam |
2 | | - |
3 | | -A full-stack web application for managing and sharing past exam materials, built with Vue.js frontend and FastAPI backend. |
4 | | - |
5 | | -## Project Structure |
6 | | - |
7 | | -``` |
8 | | -pastexam/ |
9 | | -├── frontend/ # Vue.js 3 + Vite frontend |
10 | | -├── backend/ # FastAPI Python backend |
11 | | -├── docker/ # Docker configuration files |
12 | | -└── proxy/ # Nginx reverse proxy |
13 | | -``` |
14 | | - |
15 | | -## Prerequisites |
16 | | - |
17 | | -- **Node.js** (v18 or higher) |
18 | | -- **Python** (v3.11 or higher) |
19 | | -- **Docker** and **Docker Compose** |
20 | | -- **uv** (Python package manager) |
21 | | - |
22 | | -## Quick Start |
23 | | - |
24 | | -### 1. Clone the repository |
25 | | - |
26 | | -```bash |
27 | | -git clone https://github.com/NCTUCSUnion/pastexam.git |
28 | | -cd pastexam |
29 | | -``` |
30 | | - |
31 | | -### 2. Start infrastructure services |
32 | | - |
33 | | -```bash |
34 | | -cd docker |
35 | | -docker compose -f docker-compose.dev.yml up -d |
36 | | -``` |
37 | | - |
38 | | -### 3. Backend setup |
39 | | - |
40 | | -```bash |
41 | | -cd backend |
42 | | -uv sync |
43 | | -uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 |
44 | | -``` |
45 | | - |
46 | | -### 4. Frontend setup |
47 | | - |
48 | | -```bash |
49 | | -cd frontend |
50 | | -npm install |
51 | | -npm run dev |
52 | | -``` |
53 | | - |
54 | | -## Development |
55 | | - |
56 | | -### Frontend Development |
57 | | - |
58 | | -#### Project setup |
59 | | - |
60 | | -```bash |
61 | | -cd frontend |
62 | | -npm install |
63 | | -``` |
64 | | - |
65 | | -#### Compiles and hot-reloads for development |
66 | | - |
67 | | -```bash |
68 | | -npm run dev |
69 | | -``` |
70 | | - |
71 | | -#### Compiles and minifies for production |
72 | | - |
73 | | -```bash |
74 | | -npm run build |
75 | | -``` |
76 | | - |
77 | | -#### Linting & Formatting |
78 | | - |
79 | | -**ESLint** |
80 | | - |
81 | | -```bash |
82 | | -npm run lint |
83 | | -# or |
84 | | -npx eslint --ext .js,.vue src |
85 | | -``` |
86 | | - |
87 | | -**Prettier** |
88 | | - |
89 | | -```bash |
90 | | -npm run format |
91 | | -# or |
92 | | -npx prettier --write . |
93 | | -``` |
94 | | - |
95 | | -### Backend Development |
96 | | - |
97 | | -#### Project setup |
98 | | - |
99 | | -```bash |
100 | | -cd backend |
101 | | -uv sync |
102 | | -``` |
103 | | - |
104 | | -#### Run development server |
105 | | - |
106 | | -```bash |
107 | | -uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 |
108 | | -``` |
109 | | - |
110 | | -#### Run tests |
111 | | - |
112 | | -```bash |
113 | | -uv run pytest |
114 | | -``` |
115 | | - |
116 | | -## Docker Deployment |
117 | | - |
118 | | -### Development Environment |
119 | | - |
120 | | -```bash |
121 | | -cd docker |
122 | | -docker compose -f docker-compose.dev.yml up -d |
123 | | -``` |
124 | | - |
125 | | -### Production Environment |
126 | | - |
127 | | -```bash |
128 | | -cd docker |
129 | | -docker compose up -d |
130 | | -``` |
131 | | - |
132 | | -## Environment Variables |
133 | | - |
134 | | -### Backend (.env) |
135 | | - |
136 | | -```env |
137 | | -# Database |
138 | | -POSTGRES_USER=your_db_user |
139 | | -POSTGRES_PASSWORD=your_db_password |
140 | | -POSTGRES_DB=your_db_name |
141 | | -POSTGRES_PORT=5432 |
142 | | -
|
143 | | -# Redis |
144 | | -REDIS_URL=redis://localhost:6379 |
145 | | -
|
146 | | -# MinIO |
147 | | -MINIO_ROOT_USER=your_minio_user |
148 | | -MINIO_ROOT_PASSWORD=your_minio_password |
149 | | -
|
150 | | -# JWT |
151 | | -SECRET_KEY=your_secret_key |
152 | | -ALGORITHM=HS256 |
153 | | -ACCESS_TOKEN_EXPIRE_MINUTES=30 |
154 | | -``` |
155 | | - |
156 | | -## Configuration |
157 | | - |
158 | | -### Frontend Configuration |
159 | | - |
160 | | -The frontend configuration is handled through Vite and can be customized in `frontend/vite.config.js`. |
161 | | - |
162 | | -### Backend Configuration |
163 | | - |
164 | | -Backend configuration is managed through Pydantic settings in `backend/app/core/config.py`. |
165 | | - |
166 | | -## API Documentation |
167 | | - |
168 | | -Once the backend is running, you can access the interactive API documentation at: |
169 | | - |
170 | | -- **Swagger UI**: http://localhost:8000/docs |
171 | | -- **ReDoc**: http://localhost:8000/redoc |
172 | | - |
173 | | -## Testing |
174 | | - |
175 | | -### Frontend Tests |
176 | | - |
177 | | -```bash |
178 | | -cd frontend |
179 | | -npm run test |
180 | | -``` |
181 | | - |
182 | | -### Backend Tests |
183 | | - |
184 | | -```bash |
185 | | -cd backend |
186 | | -uv run pytest |
187 | | -``` |
188 | | - |
189 | | -## Build for Production |
190 | | - |
191 | | -### Frontend Build |
192 | | - |
193 | | -```bash |
194 | | -cd frontend |
195 | | -npm run build |
196 | | -``` |
197 | | - |
198 | | -### Backend Build |
199 | | - |
200 | | -```bash |
201 | | -cd backend |
202 | | -uv run uvicorn app.main:app --host 0.0.0.0 --port 8000 |
203 | | -``` |
204 | | - |
205 | | -## Deployment |
206 | | - |
207 | | -### Using Docker Compose |
208 | | - |
209 | | -```bash |
210 | | -cd docker |
211 | | -docker compose up -d |
212 | | -``` |
213 | | - |
214 | | -### Manual Deployment |
215 | | - |
216 | | -1. Build the frontend: `npm run build` |
217 | | -2. Start the backend: `uv run uvicorn app.main:app --host 0.0.0.0 --port 8000` |
218 | | -3. Configure Nginx to serve the frontend and proxy to the backend |
219 | | - |
220 | | -## License |
221 | | - |
222 | | -This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
223 | | - |
224 | | -## Support |
225 | | - |
226 | | -If you encounter any issues or have questions, please: |
227 | | - |
228 | | -1. Check the [Issues](https://github.com/your-repo/issues) page |
229 | | -2. Create a new issue with detailed information |
230 | | -3. Contact the development team |
| 1 | +<p align="center"> |
| 2 | + <picture> |
| 3 | + <source media="(prefers-color-scheme: dark)" srcset="https://github.com/user-attachments/assets/2950f4b0-f11d-46e4-98fb-28c0e701dcbc"> |
| 4 | + <source media="(prefers-color-scheme: light)" srcset="https://github.com/user-attachments/assets/6125c7f1-5e26-4cfc-93dc-67a77720011d"> |
| 5 | + <img alt="Pastexam banner"> |
| 6 | + </picture> |
| 7 | + <br> |
| 8 | + <br> |
| 9 | + <a href="https://github.com/NCTUCSUnion/pastexam/releases/latest"><img alt="Release" src="https://img.shields.io/github/v/release/NCTUCSUnion/pastexam?color=mediumseagreen"></a> |
| 10 | + <br> |
| 11 | + <br> |
| 12 | + <strong>交大資工考古題系統</strong> |
| 13 | + <br> |
| 14 | + <br> |
| 15 | + <a href="https://pastexam.nctucsunion.me/">Visit Website</a> |
| 16 | + | |
| 17 | + <a href="https://github.com/NCTUCSUnion/pastexam/issues">Report Bug</a> |
| 18 | + | |
| 19 | + <a href="https://github.com/NCTUCSUnion/pastexam/issues">Request Feature</a> |
| 20 | + <br> |
| 21 | +</p> |
0 commit comments