How mavenagi-apps/stripe works
Project type and purpose
• This is a Next.js–based serverless app whose primary job is to fetch a subset of customer data from the Stripe API, push that data into the Maven User API, then invoke two actions via the Maven Actions API. In the future it will use Inngest for asynchronous workflows at scale.
File structure
• Top-level config:
• next.config.mjs, tsconfig.json, env.d.ts, settings.d.ts (TypeScript and Next.js configs)
• package.json / package-lock.json (dependencies: Next.js, Stripe SDK, Maven SDK etc.)
• Source code:
• src/index.ts – application entry point (bootstraps any shared libraries or middleware)
• src/app/route.ts – Next.js API route handler (the single HTTP endpoint)
• Supporting files: ESLint and gitignore, README for context.
Extract architectural insights from the README
• Synchronous workflow currently: HTTP request → route.ts handler → Stripe API call → User API call → Actions API calls → HTTP response.
• Planned future addition: integrate Inngest for fan-out asynchronous processing of full customer data at scale.
Main components & interactions
a. Components:
1. Client (e.g., Playground or any HTTP client)
2. Next.js API Route (src/app/route.ts)
3. Stripe API (external)
4. Maven User API (external)
5. Maven Actions API (external)
6. (Future) Inngest Workflow Engine
b. Relationships / data flows:
• Client → Next.js Route: incoming HTTP POST/GET to your serverless endpoint
• Next.js Route → Stripe API: fetch limited customer data
• Next.js Route → Maven User API: upsert user record
• Next.js Route → Maven Actions API: invoke two distinct actions using the stored user data
• Next.js Route → HTTP Response back to client
• (Future) Next.js Route → Inngest: dispatch a job for expanded data fetch and processing
c. Architectural patterns & design principles:
• API-First, Serverless / Edge Functions (using Next.js routing)
• Single responsibility: route.ts is the orchestration layer
• Separation of concerns: external services handle storage and action logic
• Planned event-driven design with Inngest for long-running workflows
d. Key technologies / libraries:
• Next.js (app router in src/app)
• TypeScript (env.d.ts, settings.d.ts)
• Stripe Node SDK (calls to Stripe API)
• Maven SDK or HTTP client (interactions with User & Actions APIs)
• Inngest (future async orchestrator)