How varadarajan-m/form-craft works
Primary components and layers
• Frontend (Client UI):
• Next.js application (found in src/app) which includes pages for the dashboard, form builder, form viewer, landing page, sign-in/up flows, etc.
• Specialized UI zones such as “Dashboard”, “Builder”, and “Form Viewer”. Note the components for analytics, data visualization (charts, cards) and the drag-and-drop builder functionality.
• Shared UI modules and common components (in src/components/ui and src/components/common).
• Backend (API & Server Logic):
• API endpoints under src/app/api. These endpoints respond to callbacks (from Airtable and Google), refresh tokens, webhook calls, and form-related tasks (like AI prompt handling).
• Business logic and controllers in the src/backend directory (actions, models, and database connection) which handle form submissions, analytics, integrations, and CRUD operations.
• Database or Data Persistence Layer:
• While the explicit database technology isn’t mentioned, the presence of src/backend/db/connection.ts and models indicates a data persistence layer for storing forms, submissions, templates, and analytics data.
• Third-Party Integrations:
• External services such as Airtable, Google (including Sheets integration), and webhooks.
• For integrations, illustrate both the callback API endpoints and any dedicated integration modules (in src/app/api/callback/* and inside builder integrations).
• Additional Utilities and State Management:
• Usage of utilities, hooks (e.g., useDebounceEffect, useFeatureAnnouncer) and the Zustand-based state management (in src/zustand) that help manage the client-side state.
• Utility libraries for functions like form validation, date/time, and common helper methods (in src/lib).
• Data Flow:
• API/backend to external services (Airtable, Google, Webhook) via clearly marked integration connectors representing the callbacks and communication routes.
• Communication Patterns:
• REST or serverless API pattern implemented in “src/app/api” for asynchronous requests.
• Real-time analytics requests from frontend components to the backend actions.
Architectural Patterns and Key Design Principles
• Modular Separation:
• The project cleanly separates concerns by placing UI components (for rendering and interactivity) in the frontend, and the business logic and integrations in the backend.
• The builder (drag-and-drop interface) seems to have a dedicated folder structure, emphasizing component reusability and separation of the left pane, center pane, and right pane for configuration.
• Layered Architecture:
• Use layers to indicate that the system is divided into Presentation (Next.js pages and components), Application Logic (API routes, backend actions/models), and Data Persistence (database connection and models).
• Extensibility:
• The presence of numerous integration modules (airtable, google-sheets, webhook) implies that the architecture is designed to easily add new third-party integrations.
• React and Next.js Conventions:
• Recognize file-based routing (Next.js pages), which is reflected in the organization of src/app and API routes. Also note the use of middleware and providers for global configurations.