How sharan-2686/cardcraft works
Purpose and Shape
CardConnect is a digital business-card platform with authentication, card creation/viewing, administrative management, QR, widget, and email-signature experiences. It has two independently packaged layers: an Express-style Node backend in backend/ and a Next.js frontend in next-app/. A separate nested Vite client also exists under next-app/CardConnect/CardConnect/client/, likely an older or parallel frontend.
Runtime Entry Points
• Backend service starts from backend/server.js, with persistence initialization in backend/db.js.
• The primary UI is a Next.js App Router application rooted at next-app/app/layout.tsx and next-app/app/page.tsx.
• Client-side identity state is provided through next-app/app/context/AuthContext.tsx.
• The nested Vite application enters through next-app/CardConnect/CardConnect/client/src/main.jsx and next-app/CardConnect/CardConnect/client/src/App.jsx; its relationship to the Next app is not established by the repository tree.
API and Authentication Boundary
The backend exposes route groups for authentication, cards, and administration:
• backend/authRoutes.js delegates identity actions to backend/authController.js.
• backend/cardRoutes.js delegates card operations to backend/cardController.js.
• backend/adminRoutes.js delegates privileged operations to backend/adminController.js.
• backend/authMiddleware.js is the authorization boundary protecting routes or controller operations. Frontend pages and AuthContext.tsx are the likely consumers of these API endpoints.
Domain Persistence
The core persisted entities are users and cards:
• backend/User.js
• backend/Card.js
• backend/db.js
Controllers form the application layer between HTTP requests and these domain models. Card identity is surfaced publicly through the dynamic route next-app/app/card/[id]/page.tsx, with associated presentation styling in next-app/app/card/[id]/card-view.css.
Frontend Product Flows
The Next.js app organizes major user workflows as route-level screens:
• Login: next-app/app/login/page.tsx
• Authenticated dashboard: next-app/app/dashboard/page.tsx
• Card authoring: next-app/app/create-card/page.tsx
• Public/specific card viewing: next-app/app/card/[id]/page.tsx
• Administration: next-app/app/admin/page.tsx
Additional output and sharing surfaces are next-app/app/qr/page.tsx, next-app/app/widgets/page.tsx, and next-app/app/email-signatures/page.tsx. These likely derive from card data but their backend integration is not visible in the tree.
Email and External Delivery
Email handling is isolated behind backend/emailController.js, separating outbound email behavior from identity, card, and admin controllers. The specific provider, credentials, delivery trigger, and queueing model cannot be determined from the supplied files.
UI Composition and Assets
Shared page chrome and visual primitives are centralized in:
• next-app/components/Header.tsx
• next-app/components/Footer.tsx
• next-app/components/ui/
Global styling begins at next-app/app/globals.css; route-specific card and creation styles live beside their routes. Video/media assets are served from next-app/public/, while the parallel Vite client maintains its own assets under next-app/CardConnect/CardConnect/client/src/assets/.
Main entry points: cardRoutes.js Card routes · authRoutes.js Auth routes · server.js Backend server · adminRoutes.js Admin routes
Components 23
Node backend
- Backend server
backend/server.js - Database initialization
backend/db.js - Auth routes
backend/authRoutes.js - Card routes
backend/cardRoutes.js - Admin routes
backend/adminRoutes.js - Authorization middleware · Protects routes or controller operations.
backend/authMiddleware.js - Auth controller
backend/authController.js - Card controller
backend/cardController.js - Admin controller
backend/adminController.js - Email controller · Provider and delivery trigger are not established.
backend/emailController.js - User model
backend/User.js - Card model
backend/Card.js
Next.js app
- App shell
next-app/app/layout.tsx - Home page
next-app/app/page.tsx - Auth context
next-app/app/context/AuthContext.tsx - Login and dashboard
next-app/app/login/page.tsx - Card authoring
next-app/app/create-card/page.tsx - Public card view
next-app/app/card/[id]/page.tsx - Admin page
next-app/app/admin/page.tsx - QR, widgets and signatures · These surfaces likely derive from card data.
next-app/app/qr/page.tsx - Shared UI chrome
next-app/components/Header.tsx
Parallel Vite client
Its integration with the Next.js app is not established.
- Vite entry
next-app/CardConnect/CardConnect/client/src/main.jsx - Vite app
next-app/CardConnect/CardConnect/client/src/App.jsx
Connections 25
- Backend server → Database initialization: initializes
- Backend server → Auth routes: mounts
- Backend server → Card routes: mounts
- Backend server → Admin routes: mounts
- Auth routes → Authorization middleware: uses
- Card routes → Authorization middleware: uses
- Admin routes → Authorization middleware: uses
- Auth routes → Auth controller: delegates to
- Card routes → Card controller: delegates to
- Admin routes → Admin controller: delegates to
- Auth controller → User model: reads and writes
- Card controller → Card model: reads and writes
- Admin controller → User model: manages
- Admin controller → Card model: manages
- Email controller → User model: uses recipient identity
- App shell → Home page: hosts
- App shell → Auth context: provides
- App shell → Shared UI chrome: composes
- Auth context → Auth routes: consumes API
- Login and dashboard → Auth routes: authenticates via
- Card authoring → Card routes: creates cards via
- Public card view → Card routes: loads card via
- Admin page → Admin routes: administers via
- QR, widgets and signatures → Card routes: likely derives card data
- Vite entry → Vite app: boots