Skip to content

Commit 5b3c8a3

Browse files
committed
Remove logo image file from the frontend assets to streamline project resources.
1 parent b3fe486 commit 5b3c8a3

60 files changed

Lines changed: 6009 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

nextjs/.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
32+
33+
# env files (can opt-in for committing if needed)
34+
.env*
35+
36+
# vercel
37+
.vercel
38+
39+
# typescript
40+
*.tsbuildinfo
41+
next-env.d.ts

nextjs/README.md

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
# Pecha Tools - Next.js Application
2+
3+
A modern Next.js application for Buddhist manuscript tools with integrated backend API routes and Prisma database.
4+
5+
## Features
6+
7+
-**Complete API Integration**: All backend API routes ported to Next.js API routes
8+
-**Frontend Components**: All frontend pages and components copied and adapted
9+
-**Prisma Database**: Database schema generated based on existing models
10+
-**Auth0 Authentication**: Integrated authentication system
11+
-**Modern UI**: Tailwind CSS with custom design system
12+
-**TypeScript**: Full type safety throughout the application
13+
14+
## Project Structure
15+
16+
```
17+
nextjs/
18+
├── src/
19+
│ ├── app/ # Next.js App Router pages
20+
│ │ ├── api/ # API routes (ported from backend)
21+
│ │ │ ├── auth/ # Authentication endpoints
22+
│ │ │ ├── tools/ # Tools management API
23+
│ │ │ ├── user/ # User management API
24+
│ │ │ └── pecha/ # Pecha parsing API
25+
│ │ ├── login/ # Login page
26+
│ │ ├── logout/ # Logout page
27+
│ │ ├── profile/ # User profile page
28+
│ │ ├── layout.tsx # Root layout with providers
29+
│ │ └── page.tsx # Home page
30+
│ ├── components/ # React components
31+
│ │ ├── ui/ # UI components (shadcn/ui style)
32+
│ │ ├── Header.tsx # Navigation header
33+
│ │ ├── Footer.tsx # Footer component
34+
│ │ ├── Hero.tsx # Hero section
35+
│ │ ├── Layout.tsx # Layout wrapper
36+
│ │ ├── ToolsSection.tsx # Tools display section
37+
│ │ └── VisionSection.tsx # Mission/vision section
38+
│ ├── contexts/ # React contexts
39+
│ │ └── AuthContext.tsx # Authentication context
40+
│ ├── hooks/ # Custom hooks
41+
│ ├── lib/ # Utility libraries
42+
│ │ ├── auth.ts # Authentication utilities
43+
│ │ ├── prisma.ts # Prisma client
44+
│ │ └── utils.ts # General utilities
45+
│ └── api/ # API client functions
46+
├── prisma/
47+
│ └── schema.prisma # Database schema
48+
├── public/ # Static assets
49+
├── tailwind.config.ts # Tailwind CSS configuration
50+
├── package.json # Dependencies and scripts
51+
└── tsconfig.json # TypeScript configuration
52+
```
53+
54+
## API Routes
55+
56+
All backend API routes have been ported to Next.js:
57+
58+
### Authentication
59+
60+
- `GET /api/auth/token` - Get Auth0 token
61+
- Auth0 built-in routes: `/api/auth/login`, `/api/auth/logout`, `/api/auth/callback`
62+
63+
### Tools Management
64+
65+
- `GET /api/tools` - Get all tools
66+
- `POST /api/tools` - Create new tool (admin only)
67+
- `GET /api/tools/[toolId]` - Get specific tool
68+
- `PATCH /api/tools/[toolId]` - Update tool (admin only)
69+
- `DELETE /api/tools/[toolId]` - Delete tool (admin only)
70+
- `POST /api/tools/analytics` - Track tool usage
71+
72+
### User Management
73+
74+
- `GET /api/user/me` - Get current user profile
75+
- `POST /api/user/create` - Create/get user account
76+
- `GET /api/user` - Get all users with pagination (admin only)
77+
- `PATCH /api/user` - Update current user
78+
- `GET /api/user/[userId]` - Get specific user
79+
- `DELETE /api/user/[userId]` - Delete user (admin only)
80+
- `PATCH /api/user/[userId]/admin` - Update admin status (admin only)
81+
82+
### Pecha Processing
83+
84+
- `GET /api/pecha/[pechaId]/download` - Download pecha
85+
- `GET /api/pecha/[pechaId]/metadata` - Get pecha metadata
86+
- `GET /api/pecha/[pechaId]/bases` - Get pecha bases
87+
88+
## Database Schema
89+
90+
The Prisma schema includes:
91+
92+
```prisma
93+
model User {
94+
id String @id
95+
email String?
96+
picture String?
97+
name String?
98+
role String?
99+
isAdmin Boolean @default(false)
100+
@@map("users")
101+
}
102+
103+
model Tools {
104+
id String @id @default(uuid())
105+
name String?
106+
description String?
107+
category String?
108+
price Float?
109+
icon String?
110+
link String?
111+
demo String?
112+
@@map("tools")
113+
}
114+
```
115+
116+
## Environment Variables
117+
118+
Create a `.env.local` file with:
119+
120+
```bash
121+
# Database
122+
DATABASE_URL="postgresql://username:password@localhost:5432/database_name"
123+
124+
# Auth0 Configuration (Required)
125+
AUTH0_SECRET='use-a-long-random-value'
126+
AUTH0_BASE_URL='http://localhost:3000'
127+
AUTH0_ISSUER_BASE_URL='https://your-domain.auth0.com'
128+
AUTH0_CLIENT_ID='your-auth0-client-id'
129+
AUTH0_CLIENT_SECRET='your-auth0-client-secret'
130+
AUTH0_AUDIENCE='your-auth0-audience'
131+
132+
# Umami Analytics (Optional)
133+
NEXT_PUBLIC_UMAMI_WEBSITE_ID='your-umami-website-id'
134+
NEXT_PUBLIC_UMAMI_SRC='https://your-umami-instance.com/script.js'
135+
```
136+
137+
### Auth0 Setup
138+
139+
1. Create an Auth0 account and application
140+
2. Set your allowed callback URLs to: `http://localhost:3000/api/auth/callback`
141+
3. Set your allowed logout URLs to: `http://localhost:3000`
142+
4. Set your allowed web origins to: `http://localhost:3000`
143+
5. Copy the Domain, Client ID, and Client Secret to your `.env.local`
144+
145+
### Umami Analytics Setup (Optional)
146+
147+
1. Set up Umami analytics instance
148+
2. Create a website in Umami
149+
3. Copy the Website ID and script URL to your `.env.local`
150+
151+
## Setup Instructions
152+
153+
1. **Install Dependencies**:
154+
155+
```bash
156+
npm install
157+
```
158+
159+
2. **Setup Database**:
160+
161+
```bash
162+
# Generate Prisma client
163+
npm run db:generate
164+
165+
# Push schema to database
166+
npm run db:push
167+
```
168+
169+
3. **Configure Environment**:
170+
171+
- Copy `.env.example` to `.env.local`
172+
- Fill in your database and Auth0 credentials
173+
174+
4. **Run Development Server**:
175+
176+
```bash
177+
npm run dev
178+
```
179+
180+
5. **Open Application**:
181+
Visit [http://localhost:3000](http://localhost:3000)
182+
183+
## Available Scripts
184+
185+
- `npm run dev` - Start development server with Turbopack
186+
- `npm run build` - Build production application
187+
- `npm run start` - Start production server
188+
- `npm run lint` - Run ESLint
189+
- `npm run db:generate` - Generate Prisma client
190+
- `npm run db:push` - Push schema to database
191+
- `npm run db:studio` - Open Prisma Studio
192+
193+
## Features Implemented
194+
195+
### ✅ Backend API Routes
196+
197+
- All FastAPI endpoints converted to Next.js API routes
198+
- JWT authentication with Auth0
199+
- Database operations with Prisma
200+
- Error handling and validation
201+
202+
### ✅ Frontend Components
203+
204+
- Hero section with typewriter animation
205+
- Tools display with real-time data
206+
- Vision/mission section
207+
- Responsive navigation
208+
- User authentication UI
209+
- Profile management
210+
- Admin dashboard (planned)
211+
212+
### ✅ Authentication System
213+
214+
- Auth0 integration for SSO
215+
- Protected routes and API endpoints
216+
- User profile management
217+
- Admin role management
218+
219+
### ✅ Database Integration
220+
221+
- Prisma ORM setup
222+
- PostgreSQL compatibility
223+
- Schema migrations
224+
- Type-safe database queries
225+
226+
### ✅ Modern UI/UX
227+
228+
- Tailwind CSS styling
229+
- Responsive design
230+
- Custom color scheme matching brand
231+
- Smooth animations and transitions
232+
- shadcn/ui component library
233+
234+
## Migration Notes
235+
236+
This Next.js application contains:
237+
238+
1. **Complete API Compatibility**: All backend endpoints are available at the same paths
239+
2. **Database Schema**: Prisma schema matches the original SQLAlchemy models
240+
3. **Frontend Parity**: All React components and pages have been ported
241+
4. **Authentication**: Auth0 integration replaces custom JWT implementation
242+
5. **Modern Stack**: Uses latest Next.js 15, React 19, and TypeScript
243+
244+
## Next Steps
245+
246+
1. Configure your database connection
247+
2. Set up Auth0 application and configure credentials
248+
3. Deploy to your preferred platform (Vercel, Railway, etc.)
249+
4. Configure production environment variables
250+
5. Set up CI/CD pipeline
251+
252+
The application is now ready for development and deployment!

0 commit comments

Comments
 (0)