feat(phase-1): implement PostgreSQL + Prisma + Authentication system
Core Features: - Complete Prisma database schema with all entities (users, orgs, projects, checks, etc.) - Production-grade authentication service with Argon2 password hashing - JWT-based session management with HttpOnly cookies - Comprehensive auth middleware with role-based access control - RESTful auth API endpoints: register, login, logout, me, refresh - Database seeding with demo data for development - Rate limiting on auth endpoints (5 attempts/15min) Technical Implementation: - Type-safe authentication with Zod validation - Proper error handling and logging throughout - Secure password hashing with Argon2id - JWT tokens with 7-day expiration - Database transactions for atomic operations - Comprehensive middleware for optional/required auth - Role hierarchy system (MEMBER < ADMIN < OWNER) Database Schema: - Users with secure password storage - Organizations with membership management - Projects for organizing redirect checks - Complete audit logging system - API key management for programmatic access - Bulk job tracking for future phases Backward Compatibility: - All existing endpoints preserved and functional - No breaking changes to legacy API responses - New auth system runs alongside existing functionality Ready for Phase 2: Enhanced redirect tracking with database persistence
This commit is contained in:
13
apps/web/index.html
Normal file
13
apps/web/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Redirect Intelligence v2</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
86
apps/web/src/main.tsx
Normal file
86
apps/web/src/main.tsx
Normal file
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* Redirect Intelligence v2 - Frontend Entry Point
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
|
||||
// Placeholder component for Phase 1
|
||||
function App() {
|
||||
return (
|
||||
<div style={{
|
||||
padding: '2rem',
|
||||
fontFamily: 'system-ui, sans-serif',
|
||||
maxWidth: '800px',
|
||||
margin: '0 auto'
|
||||
}}>
|
||||
<h1>🚀 Redirect Intelligence v2</h1>
|
||||
<p>
|
||||
<strong>Phase 1: PostgreSQL + Prisma + Authentication</strong> is in progress.
|
||||
</p>
|
||||
|
||||
<div style={{
|
||||
background: '#f0f8ff',
|
||||
padding: '1rem',
|
||||
borderRadius: '8px',
|
||||
marginTop: '2rem'
|
||||
}}>
|
||||
<h3>✅ What's Working</h3>
|
||||
<ul>
|
||||
<li>Docker Compose infrastructure</li>
|
||||
<li>TypeScript API server</li>
|
||||
<li>Backward compatible legacy endpoints</li>
|
||||
<li>Database schema with Prisma</li>
|
||||
<li>Authentication system (JWT + Argon2)</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div style={{
|
||||
background: '#fff8dc',
|
||||
padding: '1rem',
|
||||
borderRadius: '8px',
|
||||
marginTop: '1rem'
|
||||
}}>
|
||||
<h3>🚧 Coming Next</h3>
|
||||
<ul>
|
||||
<li>Chakra UI frontend (Phase 4)</li>
|
||||
<li>Enhanced redirect analysis (Phase 2-3)</li>
|
||||
<li>Bulk processing (Phase 6)</li>
|
||||
<li>Monitoring & alerts (Phase 10)</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div style={{ marginTop: '2rem' }}>
|
||||
<h3>🔗 API Endpoints</h3>
|
||||
<p>Test the API directly:</p>
|
||||
<ul>
|
||||
<li><a href="/api/docs">/api/docs</a> - API Documentation</li>
|
||||
<li><a href="/health">/health</a> - Health Check</li>
|
||||
<li><code>POST /api/v1/auth/register</code> - User Registration</li>
|
||||
<li><code>POST /api/v1/auth/login</code> - User Login</li>
|
||||
<li><code>GET /api/v1/auth/me</code> - User Profile</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div style={{
|
||||
marginTop: '2rem',
|
||||
padding: '1rem',
|
||||
background: '#f5f5f5',
|
||||
borderRadius: '8px'
|
||||
}}>
|
||||
<h4>🧪 Test the Legacy Endpoints (100% Compatible)</h4>
|
||||
<pre style={{ background: '#000', color: '#0f0', padding: '1rem', overflow: 'auto' }}>
|
||||
{`curl -X POST ${window.location.origin}/api/v1/track \\
|
||||
-H "Content-Type: application/json" \\
|
||||
-d '{"url": "github.com", "method": "GET"}'`}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
);
|
||||
Reference in New Issue
Block a user