๐ Project Overview
PromptForge is a modern web-based toolkit designed to boost developer productivity with AI-powered utilities. It provides smart, context-aware tools inside a clean and responsive interface.
๐ฏ Mission
Democratize access to AI-powered development tools through an intuitive, accessible interface that understands developer workflows.
โจ Vision
Create a comprehensive suite of intelligent tools that adapt to individual coding styles and become an indispensable part of every developer's toolkit.
โจ Core Features
Code Explainer
#1AI-powered code analysis that breaks down complex code into understandable explanations.
Uses server actions to process code through AI APIs, with streaming responses for real-time explanations.
Bug Fixer
#2Automatically detects and fixes common programming errors with detailed explanations.
Parses error messages and code context, then generates optimized fixes with step-by-step reasoning.
Regex Generator
#3Converts natural language descriptions into functional regular expressions.
Processes user descriptions, generates and tests regex patterns, provides explanations and usage examples.
JWT Authentication
#4Secure user authentication with token-based sessions and protected routes.
Stateless authentication with refresh tokens, role-based access control, and secure credential storage.
โก Next.js Concepts in Practice
Static Site Generation (SSG)
Pre-renders pages at build time, generating static HTML files that can be served instantly.
Used for documentation pages, landing pages, and any content that doesn't require real-time data fetching.
- โLightning fast page loads
- โExcellent SEO performance
- โReduced server load
- โCDN cacheable content
// This page uses SSG with revalidation
export async function generateStaticParams() {
return [{ slug: 'docs' }];
}
export const revalidate = 3600; // Revalidate every hour (ISR)Incremental Static Regeneration (ISR)
Allows you to update static content after build time without rebuilding the entire site.
Applied to documentation that might need updates without redeployment. API docs are regenerated periodically.
- โDynamic content with static speed
- โNo need for full rebuilds
- โBackground regeneration
- โStale-while-revalidate pattern
App Router Structure
Next.js 13+ introduces a file-system based router with improved performance and features.
Organized with app/ directory structure, using layout.tsx for shared UI and page.tsx for route segments.
- โNested layouts
- โStreaming support
- โImproved loading states
- โSimplified data fetching
Server Components by Default
Components are rendered on the server by default, reducing JavaScript bundle size.
All documentation pages are server components, fetching data and rendering HTML on the server.
- โSmaller client bundles
- โFaster initial load
- โBetter SEO
- โDirect database/API access
Route Handlers (API Routes)
Create API endpoints alongside your pages in the app directory.
Used for authentication, AI API proxying, and user data management in /app/api/ routes.
- โUnified project structure
- โTypeScript support
- โMiddleware integration
- โEdge runtime support
๐ External API Integrations
DeepSeek Chat Completion
Generate AI-powered code explanations and bug fixes using DeepSeek's advanced language model.
Example Request:
{
"model": "deepseek-coder",
"messages": [
{"role": "system", "content": "You are an expert code assistant"},
{"role": "user", "content": "Explain this React component..."}
],
"temperature": 0.7
}Example Response:
{
"id": "chatcmpl-123",
"choices": [{
"message": {
"role": "assistant",
"content": "This React component uses hooks for state management..."
}
}],
"usage": {"total_tokens": 150}
}OpenAI Code Completion
Generate regex patterns and code completions with OpenAI's models.
Example Request:
{
"model": "gpt-4",
"prompt": "Generate regex for email validation",
"max_tokens": 100
}Example Response:
{
"id": "cmpl-123",
"choices": [{
"text": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"
}]
}JWT Authentication
Secure user authentication with JSON Web Tokens.
Example Request:
{
"email": "user@example.com",
"password": "securepassword123"
}Example Response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": "123",
"email": "user@example.com",
"name": "John Doe"
}
}๐ ๏ธ Technology Stack
Frontend
- Next.js 16
- React 18
- TypeScript
- TailwindCSS
- Shadcn/UI
Backend
- Express.js
- Node.js
- MongoDB
- Mongoose
- JWT
AI/ML
- DeepSeek API
- OpenAI API
- LangChain
- Prompt Engineering
Authentication
- JWT Tokens
- bcrypt
- HttpOnly Cookies
- OAuth 2.0
DevOps
- Vercel
- Railway
- MongoDB Atlas
- GitHub Actions
Monitoring
- Sentry
- Vercel Analytics
- Custom Logging
๐ Deployment Guide
SSG/ISR Configuration
// This page configuration
export async function generateStaticParams() {
return [{ slug: 'docs' }];
}
// Revalidate every hour (ISR)
export const revalidate = 3600;
// Static generation without client-side JS
export default async function DocumentationPage() {
const data = await getExternalAPIDocs();
// ... rest of the component
}This page uses Incremental Static Regeneration (ISR) to provide fast static delivery with periodic updates. The content is generated at build time and revalidated every hour.
Environment Variables
# Frontend (.env.local)
NEXT_PUBLIC_API_URL=https://api.promptforge.dev
NEXT_PUBLIC_APP_URL=https://promptforge.dev
# Backend (.env)
OPENAI_API_KEY=sk-...
DEEPSEEK_API_KEY=sk-...
JWT_SECRET=your-secret-key
MONGO_URI=mongodb+srv://...
Build & Deploy
# Production build
npm run build
# Export static files (for SSG)
npm run export
# Deploy to Vercel
vercel --prod
# Or deploy manually
npm run start๐ฏ Best Practices Implemented
Security
- ๐API keys stored server-side only
- ๐ก๏ธJWT with HttpOnly cookies
- ๐Rate limiting on all API endpoints
Performance
- โกSSG/ISR for optimal loading
- ๐ฆCode splitting with dynamic imports
- ๐ผ๏ธOptimized images with Next/Image
Development
- ๐งชTypeScript for type safety
- ๐Comprehensive error handling
- ๐งEnvironment-based configuration
SEO & Accessibility
- ๐Semantic HTML structure
- โฟARIA labels and keyboard navigation
- ๐ฑFully responsive design