How swapnilgupta14/synapse-an-enterprise-workflow-application works
Project type and purpose
• This is a full-stack, single‐page application (SPA) named “Synapse” for enterprise workflow and collaboration.
• Frontend: React + TypeScript + Vite + Tailwind CSS
• Backend: JSON Server (db.json) serving as a mock REST API
• Purpose: allow admins, organizations, and users to manage projects, teams, tasks, view analytics, and handle personal to-dos in a role-based UI.
File structure
• Top-level directories/files:
• public, index.html → static assets and entry point
• src → all React code (App.tsx, main.tsx), CSS, types, utils
• server/db.json → mock database for JSON Server
• playwright.config.ts, tests, tests-examples → end-to-end and unit tests
• vite.config.ts, tsconfig*.json, package.json → build & config
• Inside src:
• src/pages & src/components → view layer, dashboards per role
• src/api & src/utils → network layer (axiosInstance, fetch) & helpers (token, localStorage)
• src/redux & src/context → state management (Redux Toolkit slices, React Context for auth/project/team)
• src/routes → React Router route definitions
• src/styles, tailwind.config.js → styling
README for additional insights
• Synapse features: project management, team collaboration, task allocation, analytics, responsive design, role-based dashboards
• Highlights tech stack: React, TypeScript, Vite, Tailwind, JSON Server, Axios, Redux Toolkit, Playwright, Jest, React Router, Vercel
a. Main Components
• Client (Browser)
• React SPA
• Routing Layer (React Router)
• UI Component Tree (Pages, Dashboards, Shared UI)
• State Management
– Redux Store
– Context Providers (Auth, Project, Team)
• Network Layer
– Axios Instance
– Service Modules (userServices, projectServices, etc.)
• Mock Backend
– JSON Server (db.json)
• Data Store
– db.json file representing persisting data
• External/Infrastructure
– Vercel (deployment hosting)
– Browser localStorage (for tokens)
b. Relationships & Data Flow
1. Browser → React SPA (load index.html → main.tsx → App)
2. React Router routes requests to specific dashboards/pages
3. UI Components dispatch Redux actions or update Context
4. Redux middleware or service modules call Axios to JSON Server endpoints
5. JSON Server reads/writes db.json, returns JSON responses
6. Responses flow back → network layer → Redux/Context → UI
7. Analytics components read aggregated data from store
8. Authentication uses generateToken & localStorage to persist session
c. Architectural Patterns & Principles
• Component-based UI (atomic UI, dashboards, popups)
• Separation of concerns: UI vs state vs network vs data
• API abstraction: service modules encapsulate REST calls
• Role-based route guarding (ProtectedRoute component)
• State co-existence: Redux for global slices, React Context for scoped contexts
• Mock backend for rapid prototyping/testing (JSON Server)
d. Key Technologies & Frameworks
• React & React Router
• TypeScript & Vite
• Tailwind CSS for styling
• Redux Toolkit & React Context
• Axios for HTTP
• JSON Server as REST API
• Playwright & Jest for testing
• Vercel for deployment