How imaditya-jain/everm-re works
1. This is a Next.js App Router application with a mixed frontend/backend shape: UI pages live under app/(pages) and server endpoints live under app/api/v1. The repository is organized around account/auth workflows plus a Shopify integration and an AI SEO generation feature.
2. The public UI surface is split into a small set of route groups:
- / home page
- /auth/* authentication screens
- /dashboard protected application area
The auth pages are wrapped by an auth-specific layout in app/components/layout/auth, and the dashboard is guarded by a ProtectedRoute component.
3. The main domain flows are authentication-centric. The API layer includes login, registration, logout, token refresh, “me”, username availability, verify-user, forgot-password, and reset-password endpoints. This indicates the app uses a server-issued session/token model rather than purely client-side auth.
4. Authentication state is split between client state and server cookies/tokens. Client-side state lives in Redux (lib/store.ts, lib/slices/*, lib/features/*), while low-level token/cookie handling is in app/utils/auth-token.utils.ts and app/utils/auth-cookie.utils.ts. An auth-session-provider bridges auth state into the React tree.
5. Account recovery and verification have an email-backed backend path. The mail config and helper (app/config/nodemailer.config.ts, app/helpers/mail/send-mail.helper.ts) support the forgot-password, reset-password, and verify-user routes. Those flows likely generate tokens and send transactional email from the API layer.
6. The Shopify integration is a second major subsystem. It includes:
- store connection UI (app/components/shopify/connect-store-form.tsx)
- install URL generation
- OAuth callback and connect endpoints
- product sync endpoint
Helper modules cover domain validation, access-token exchange, product fetching, and client setup. This is a clear external-service boundary centered on Shopify OAuth and catalog sync.
7. AI-assisted SEO generation is exposed as an API feature at app/api/v1/ai/generate-seo. The helper layer contains prompt templates and an AI provider abstraction, so the app is likely designed to swap or encapsulate the underlying model/provider without changing the route contract.
8. The data model layer is separate from the routes and helpers. app/models/user.model.ts, store.model.ts, and product.model.ts define the persistence entities used by auth, Shopify store linkage, and synced product data. app/config/db.config.ts is the central database connection/configuration boundary.
9. There is also a small GraphQL area (app/graphQL/query.ts, mutation.ts), which suggests some backend operations are expressed as GraphQL documents or integrations rather than only REST. In diagram terms, this is an auxiliary integration layer, not the primary app surface.
10. The client UI is composed from reusable form and field components under app/components/forms, app/components/fields, and app/components/common. These feed the route pages and keep the auth screens and Shopify connect flow thin.
11. Application-wide context is provided through app/providers/StoreProvider.tsx and app/providers/auth-session-provider.tsx. These providers are the main client-side composition boundary for state, session, and access to the Redux store.
12. The supporting runtime/tooling is standard Next.js/TypeScript with app-level CSS modules and globals, plus a service worker/manifest file indicating some PWA-oriented browser support. next.config.ts, postcss.config.mjs, and eslint.config.mjs are build/runtime support rather than core architecture.
13. The clearest end-to-end data flows are:
- user auth screen → API route → token/cookie utils → Redux/auth provider → protected dashboard
- forgot/reset/verify flows → mail helper → email delivery → token-based follow-up route
- Shopify connect → OAuth callback → store model/token exchange → product sync → product model
- AI SEO request → AI route → prompt/provider helper → generated content response
14. For an architecture diagram, the main boundaries to show are: browser/UI, Next.js server routes, persistence/database, email delivery, Shopify external API, and AI provider. The repo is structured as a single Next.js application that bundles all of these concerns behind one codebase rather than splitting them into separate services.
Main entry points: v1/auth Auth API · shopify Shopify API · (pages)/auth Auth pages · db.config.ts DB config
Components 20
UI
Pages and reusable client components
- Home · Public landing page
app/page.tsx - Auth pages · Login, register, recovery, verify screens
app/(pages)/auth - Dashboard · Protected app area
app/(pages)/dashboard/page.tsx - Auth layout · Layout wrapper for auth screens
app/components/layout/auth/layout.tsx - Protected route · Client guard for dashboard access
app/components/auth/protected-route.tsx
Client State
React providers and Redux state
- Store provider · Redux provider wrapper
app/providers/StoreProvider.tsx - Session provider · Bridges auth session into React tree
app/providers/auth-session-provider.tsx - Redux state · Auth and username-check slices
lib/store.ts - Auth feature · Client auth workflows
lib/features/auth.feature.ts
API
Next.js server routes
- Auth API · Login, register, token, recovery endpoints
app/api/v1/auth - Shopify API · Connect, callback, and product sync endpoints
app/api/v1/shopify - SEO API · AI SEO generation endpoint
app/api/v1/ai/generate-seo/route.ts
Integrations
External service boundaries
- Shopify helpers · OAuth, validation, token exchange, product fetch
app/helpers/shopify - AI helper · Prompts and model abstraction
app/helpers/ai
Data
Database models and config
- DB config · Database connection boundary
app/config/db.config.ts - User model · Account persistence
app/models/user.model.ts - Store model · Shopify store linkage
app/models/store.model.ts - Product model · Synced catalog data
app/models/product.model.ts
Shared
Helpers and cross-cutting support
- Mail helper · Transactional email delivery
app/helpers/mail/send-mail.helper.ts - GraphQL docs · Auxiliary query and mutation documents
app/graphQL/query.ts
Connections 19
- Home → Auth pages: entry · Users move from landing to authentication
- Auth pages → Auth layout: wrapped by · Auth screens share a dedicated layout
- Dashboard → Protected route: guarded by · Dashboard access is protected client-side
- Protected route → Session provider: reads session · Guard depends on session state
- Store provider → Redux state: provides · Redux store is exposed to the app
- Session provider → Redux state: syncs auth · Session state bridges into Redux
- Auth pages → Auth API: calls · Auth UI submits to server auth routes
- Auth feature → Auth API: dispatches · Client feature talks to auth endpoints
- Auth API → User model: persists · Account records are stored in user model
- Auth API → DB config: uses · Auth routes depend on database connection
- Auth API → Mail helper: sends email · Recovery and verification flows send mail
- Auth API → GraphQL docs: may query · Auxiliary backend documents support some operations
- Shopify API → Shopify helpers: delegates · Shopify routes rely on integration helpers
- Shopify API → Store model: persists · Store connection data is saved
- Shopify API → Product model: syncs · Synced products are stored
- Shopify API → DB config: uses · Shopify routes use the database boundary
- SEO API → AI helper: delegates · AI route uses prompt and provider abstraction
- Mail helper → DB config: may depend on · Email workflows may reference persisted tokens or users
- Shopify helpers → GraphQL docs: supports · Shared documents can back integration operations