How dpr23/snipai works
SnipAI is a code-snippet knowledge base: developers sign in, browse and manage saved snippets, edit or create code, and request AI explanations. The sampled source confirms the authentication and editor request paths; the README documents AI analysis and MongoDB-backed storage. Dashboard and AI-route internals were not sampled, so those subsystems are represented by their exact tree paths without speculative internal wiring.
Main entry points: App.jsx Routes and guards · snippets.js Snippet API · AuthContext.jsx Auth state · auth.js Auth API
Components 17
Web application
- Routes and guards
frontend/src/App.jsx - Auth state
frontend/src/context/AuthContext.jsx - Navigation
frontend/src/components/Navbar.jsx - Sign in
frontend/src/pages/Login.jsx - Registration
frontend/src/pages/Register.jsx
Identity
- Auth API
backend/routes/auth.js - JWT middleware
backend/middleware/auth.js - User model
backend/models/User.js
Snippet management
- Snippet dashboard
frontend/src/pages/Dashboard.jsx - Snippet editor
frontend/src/pages/Editor.jsx - Snippet API
backend/routes/snippets.js - Snippet model
backend/models/Snippet.js
Backend services
- API server
backend/server.js - AI API
backend/routes/ai.js
Other components
- Developer
- MongoDB Atlas
- Google Gemini
Connections 22
- Developer → Routes and guards: uses
- Routes and guards → Auth state: provides auth
- Routes and guards → Sign in: routes
- Routes and guards → Registration: routes
- Routes and guards → Snippet dashboard: guards route
- Routes and guards → Snippet editor: guards route
- Navigation → Auth state: reads session
- Sign in → Auth state: signs in
- Registration → Auth state: registers
- Auth state → Auth API: HTTP requests
- Snippet editor → Snippet API: snippet requests
- Snippet editor → AI API: requests explanation
- API server → Auth API: mounts routes
- API server → Snippet API: mounts routes
- API server → AI API: mounts routes
- Auth API → User model: queries and saves
- Auth API → MongoDB Atlas: persists users
- Snippet API → JWT middleware: protects endpoints
- Snippet API → Snippet model: queries and saves
- Snippet API → MongoDB Atlas: persists snippets
- AI API → Google Gemini: analyzes code
- Snippet dashboard → Snippet API: browses snippets