OptiGame is a full-stack web application for discovering, reviewing, and managing board games. It features a React + TypeScript frontend, a FastAPI backend, JWT-based authentication, and a PostgreSQL database.
Users can see a full list of features and signup for an account here: https://optigame-front-end.onrender.com/
- User Authentication: Secure signup, login, and logout with JWT tokens.
- Game Discovery: Browse and search for board games.
- User Profile: View and manage your personal game shelf and reviews.
- Game Reviews: Add ratings and reviews for games.
- Similar Games: Get recommendations for similar games.
- Protected Routes: Only authenticated users can access certain pages.
- Responsive UI: Built with Chakra UI for a modern look.
- Frontend: React, TypeScript, Chakra UI, React Router
- Backend: FastAPI, SQLAlchemy, PostgreSQL
- Authentication: JWT (JSON Web Tokens), passlib (bcrypt)
- State Management: React Context API
- Node.js & npm
- Python 3.8+
- PostgreSQL
-
Install dependencies:
pip install fastapi uvicorn sqlalchemy psycopg2-binary python-dotenv passlib[bcrypt] python-jose
-
Configure environment variables:
- Copy
.env2.exampleto.env2and fill in your database and JWT settings.
- Copy
-
Run the backend:
uvicorn main:app --reload
-
Install dependencies:
npm install
-
Run the frontend:
npm run dev
-
Open your browser:
Visit http://localhost:5173 (or the port shown in your terminal).
optigame_simple/
├── FastApi/ # FastAPI backend
│ ├── main.py
│ ├── models.py
│ └── ...
├── optigame_simple/
│ └── optigame/
│ ├── src/
│ │ ├── context/
│ │ │ └── UserContext.tsx
│ │ ├── hooks/
│ │ ├── pages/
│ │ ├── main.tsx
│ │ └── ...
│ └── ...
└── ...
-
Backend
main.py– FastAPI app, endpoints, JWT logicmodels.py– SQLAlchemy models
-
Frontend
src/main.tsx– React entry pointsrc/context/UserContext.tsx– User authentication contextsrc/pages/LoginSignup/Login.tsx– Login pagesrc/pages/LoginSignup/Protected.tsx– Route protection
- On login, the backend returns a JWT token.
- The frontend stores the token and username in
localStorage. - Protected routes check for a valid token and redirect to login if invalid or expired.
- On logout, the token and username are removed from
localStorage.
- Add new games: Extend the backend models and endpoints.
- Change database: Update the
DATABASE_URLin.env2. - Styling: Modify Chakra UI components in the frontend.
MIT