How marwafarid344-lang/morx-team works
1. High-level shape
- Morx is a Next.js App Router application for team task management.
- The repo is split into two major planes: UI pages under app/ and server API routes under app/api/.
- Domain appears centered on users, teams, projects, tasks, notifications, templates, analytics, and recruitment.
2. Frontend presentation layer
- Most user-facing screens live in app/*/page.tsx, including landing, auth, teams, projects, tasks-related views, templates, talent, reports, settings, and legal pages.
- Nested layouts such as app/analytics/layout.tsx and app/complete-profile/layout.tsx suggest route-scoped shells for authenticated or specialized workflows.
- The app likely relies on server-rendered pages plus client components where interactivity is needed.
3. Component system
- Reusable UI is concentrated in components/, with a large components/ui/ base layer that looks like a design-system / shadcn-style component kit.
- Feature components such as TaskCalendar, TaskDocEditor, notification-panel, report-table, template-library, and TutorialOverlay indicate that much of the app’s behavior is composed from reusable widgets rather than page-specific logic.
- Cross-cutting UX wrappers include auth transition/session sync, theme providers, and tutorial providers.
4. Authentication and onboarding boundary
- Auth is handled through several routes: app/api/auth/*, app/api/login, app/auth/callback, and NextAuth under app/api/auth/[...nextauth].
- There are dedicated flows for signup, login, Google OAuth callback, password reset, session fetching, profile completion, and signup completion.
- This suggests a multi-step onboarding boundary: public auth pages, an OAuth/session bridge, then protected application routes after profile completion.
5. Backend API layer
- The server API is extensive and organized by domain: users, teams, projects, tasks, comments, notifications, templates, analytics, recruitment, and ai.
- Routes follow REST-like patterns with nested resource actions, for example task assignment, file upload, comment likes, team membership, invite/join flows, and template rating.
- This API layer is the main boundary where the UI talks to persistent data and business rules.
6. Core domain model
- The main entities are clearly:
- User: profile, stats, notifications, teams, onboarding state
- Team: members, requests, reports, stats, join/invite lifecycle
- Project: project pages plus member management
- Task: assignment, docs, files, comments, status tracking
- Template: create project from template, rating, browsing
- Notification: due-task checks, read state, user notification feed
- The architecture is organized around these resources rather than around a single monolithic dashboard.
7. Task collaboration workflow
- Tasks are not just records; they support assignment, comments, likes, documents, and files.
- The presence of app/api/tasks/[taskId]/assign, /docs, /file, /files, and comments/like implies a collaborative workflow where task metadata, discussion, and attachments are all first-class.
- Public-facing task interactions likely feed into notifications and analytics.
8. Team and project lifecycle
- Teams have join, request, member, report, and stats endpoints, plus team-specific pages for browsing, joining, reports, and settings.
- Projects are scoped by URL and have member management, indicating a team-centric project container model.
- lib/utils/teamUrl.ts suggests URL slugs are part of the identity and routing model for teams.
9. Templates and talent marketplace
- Templates are a separate subsystem for bootstrapping projects, with browse, create-project-from-template, and rating flows.
- The talent marketplace has its own pages and recruitment APIs for invitations, responses, and talent search.
- These are adjacent to the core task system but represent discovery/activation flows rather than day-to-day execution.
10. Analytics and reporting
- There are both general analytics routes and team-specific reports/stats pages.
- Components like chart-card, stats-card, and report-table indicate the reporting layer consumes aggregated API data rather than raw entity views.
- Analytics likely spans task completion, team activity, and user/team performance indicators referenced in the README.
11. AI-assisted features
- app/api/ai/generate, generate-description, and usage show AI is treated as a service boundary with usage tracking.
- The UI includes ai-description-button, implying AI is used to assist content generation, probably task or project descriptions.
- lib/utils/aiUsage.ts suggests the app tracks consumption or quotas for AI features.
12. Persistence and infrastructure
- The repository uses Supabase as its backend data layer, with separate client and server helpers under lib/supabase/*.
- lib/middleware/auth.ts, authCompat.ts, and db-helpers.ts imply server-side access control and database convenience wrappers are centralized.
- Public uploads are stored under public/uploads/tasks, so file handling is at least partly filesystem-backed in the repo, while the app also likely integrates Supabase for authenticated data and profile state.
13. Shared app state and cross-cutting concerns
- Global concerns include theme, toast/notification UI, mobile responsiveness, and tutorial onboarding.
- contexts/auth-context.tsx, theme-provider.tsx, color-theme-provider.tsx, and tutorial context components suggest the app keeps global client state for session-aware UX.
- These layers sit above the domain features and help coordinate navigation, protected rendering, and user guidance.
14. What to draw in an architecture diagram
- Show the app as three layers: Next.js pages/components, Next.js API routes, and Supabase-backed persistence/auth.
- Place auth/onboarding as an early gate into the protected product.
- Model teams → projects → tasks as the primary domain hierarchy, with side systems for comments/files/notifications, templates, recruitment/talent, reports/analytics, and AI assistance.
Main entry points: api/page.tsx API Surface · server.ts Supabase · layout.tsx Morx · teams/page.tsx Workspaces
Components 20
App Router
User-facing pages and route-scoped shells
- Public Pages · Landing, docs, pricing, legal, and auth entry points
app/page.tsx - Workspaces · Teams, projects, tasks, templates, talent, reports, and settings
app/teams/page.tsx - Route Shells · Analytics and onboarding-specific layouts and completion flows
app/analytics/layout.tsx
API Routes
Domain APIs and auth bridges
- API Surface · Next.js route handlers for core domains
app/api/page.tsx - Auth API · Signup, login, session, OAuth callback, and profile completion
app/api/auth/[...nextauth]/route.ts - Users API · Profiles, stats, teams, notifications, and onboarding actions
app/api/users/route.ts - Teams API · Team lifecycle, join, members, requests, reports, and stats
app/api/teams/route.ts - Projects API · Project lookup and member management by URL
app/api/projects/route.ts - Tasks API · Tasks, assignment, docs, files, comments, and likes
app/api/tasks/route.ts - Templates API · Browse, rate, and create projects from templates
app/api/templates/route.ts - Recruitment API · Invitations, responses, and talent search
app/api/recruitment/invitations/route.ts - Analytics API · Aggregated metrics and reporting data
app/api/analytics/route.ts - AI API · Generation and usage tracking
app/api/ai/generate/route.ts
Shared Client
Reusable components, providers, and hooks
- UI Kit · Base shadcn-style UI primitives
components/ui/button.tsx - Feature Widgets · Task calendar, doc editor, reports, templates, and notifications
components/TaskCalendar.tsx - App State · Auth sync, theme, tutorial, mobile, and toast state
contexts/auth-context.tsx
Data Layer
Supabase and repository infrastructure
- Supabase · Server and client persistence/auth helpers
lib/supabase/server.ts - Server Helpers · Auth middleware, db helpers, URL helpers, and usage utilities
lib/middleware/auth.ts - Upload Assets · Public task uploads and static assets
public/uploads/tasks/README.md
Other components
- Morx · Team task management platform
app/layout.tsx
Connections 28
- Morx → Public Pages: renders · App shell serves public and marketing pages
- Morx → Workspaces: hosts · Primary authenticated product areas
- Morx → Route Shells: scopes · Route-specific shells for onboarding and analytics
- Public Pages → App State: uses · Shared providers and UX wrappers
- Workspaces → Feature Widgets: composes · Feature-rich screens assembled from reusable widgets
- Workspaces → UI Kit: builds on · Workspace pages use the shared component base
- API Surface → Auth API: contains · API layer includes the authentication boundary
- API Surface → Users API: contains · User profile and onboarding APIs
- API Surface → Teams API: contains · Team lifecycle APIs
- API Surface → Projects API: contains · Project APIs
- API Surface → Tasks API: contains · Task collaboration APIs
- API Surface → Templates API: contains · Template APIs
- API Surface → Recruitment API: contains · Talent and invitation APIs
- API Surface → Analytics API: contains · Metrics and reporting APIs
- API Surface → AI API: contains · AI generation and usage APIs
- Auth API → Supabase: authenticates · Session and OAuth state bridge to backend
- Users API → Supabase: reads/writes · Profiles, stats, notifications, onboarding
- Teams API → Supabase: reads/writes · Teams, members, requests, reports, stats
- Projects API → Supabase: reads/writes · Project and membership persistence
- Tasks API → Supabase: reads/writes · Tasks, comments, docs, files, assignments
- Templates API → Supabase: reads/writes · Template catalog and project creation
- Recruitment API → Supabase: reads/writes · Talent search and invite workflows
- Analytics API → Supabase: aggregates · Reporting data sourced from backend records
- AI API → Supabase: tracks usage · AI generation and quota bookkeeping
- Feature Widgets → Upload Assets: uploads · Task attachments and other stored files
- Server Helpers → Supabase: supports · Common server access and data helpers
- App State → Auth API: coordinates · Session sync and protected rendering
- App State → Feature Widgets: extends · Tutorial, theme, and toast behaviors