mirror of
https://github.com/arthur-pbty/binouz.git
synced 2026-06-03 15:07:17 +02:00
feat: add authentication and user management features
- Implemented AuthButton component for Discord sign-in and sign-out functionality. - Created CopyButton component for copying server IP addresses. - Developed EventCard and GradeCard components for displaying events and grades. - Added Footer and Navbar components for site navigation and information. - Introduced PurchaseButton for handling grade purchases with Stripe integration. - Created SectionHeader component for consistent section titles. - Implemented session management with SessionProvider for NextAuth. - Set up PostgreSQL database with Docker and Prisma for data management. - Added admin guard functionality to restrict access to certain routes. - Configured NextAuth with Discord provider for user authentication. - Defined Prisma schema for user, admin, grade, event, and purchase models. - Seeded database with initial grades and events data. - Added SVG hero image for the landing page. - Extended NextAuth types to include additional user properties.
This commit is contained in:
@@ -1,36 +1,77 @@
|
||||
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
|
||||
# BinouzUHC
|
||||
|
||||
## Getting Started
|
||||
Modern Minecraft UHC landing page with Discord authentication, admin panel, and a ready-to-docker stack.
|
||||
|
||||
First, run the development server:
|
||||
## Stack
|
||||
|
||||
- Next.js (App Router) + TypeScript
|
||||
- Tailwind CSS
|
||||
- Prisma + PostgreSQL
|
||||
- NextAuth (Discord OAuth)
|
||||
- Docker / docker-compose
|
||||
|
||||
## Quick start (Docker)
|
||||
|
||||
1. Copy env file:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
# or
|
||||
pnpm dev
|
||||
# or
|
||||
bun dev
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
2. Fill the values in `.env`:
|
||||
|
||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||
```txt
|
||||
NEXTAUTH_SECRET=
|
||||
NEXTAUTH_URL=http://localhost:3000
|
||||
|
||||
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
|
||||
DISCORD_CLIENT_ID=
|
||||
DISCORD_CLIENT_SECRET=
|
||||
|
||||
## Learn More
|
||||
DATABASE_URL=postgresql://user:password@db:5432/binouz
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
ADMIN_DISCORD_ID=
|
||||
```
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
3. Build and run:
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
||||
```bash
|
||||
docker compose up --build
|
||||
```
|
||||
|
||||
## Deploy on Vercel
|
||||
4. (Optional) Seed initial grades/events:
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
```bash
|
||||
docker compose exec app npm run db:seed
|
||||
```
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
||||
Open http://localhost:3000.
|
||||
|
||||
## Admin access
|
||||
|
||||
- Set `ADMIN_DISCORD_ID` in `.env` to the Discord user ID that should be admin.
|
||||
- First sign-in will automatically register the user and grant admin access.
|
||||
- Admin panel: `/admin`.
|
||||
|
||||
## Local development (no Docker)
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm run prisma:migrate
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## Project structure
|
||||
|
||||
```
|
||||
app/ App Router pages, layouts, API routes
|
||||
components/ UI and dashboard components
|
||||
lib/ Auth, db, helpers
|
||||
prisma/ Prisma schema and seed
|
||||
docker/ Docker notes and future overrides
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- The purchase flow is mocked and ready for Stripe integration.
|
||||
- Discord profile data is stored on sign-in (id, username, avatar).
|
||||
- Environment variables are required for OAuth and database access.
|
||||
|
||||
Reference in New Issue
Block a user