Founderflow Logo

API Routes

Understanding the API structure and endpoints of the Founderflow Boilerplate. Learn about the different API routes, their purposes, and how to use them.

API Structure (`app/api/`)

Public Routes (`/api/public/`)

Publicly accessible API endpoints that don't require authentication:

check-domain/

GET

Check domain availability for user registration

GET /api/public/check-domain?domain=example.com

feedback/

POST

Submit user feedback and suggestions

POST /api/public/feedback

lead/

POST

Capture lead information for marketing

POST /api/public/lead

registered-user/

POST

Track user registration events

POST /api/public/registered-user

Platform Routes (`/api/(platform)/`)

Protected API endpoints that require user authentication:

app/

GET

Main application data and user information

GET /api/(platform)/app

app/billing/

GET

User billing information and subscription details

GET /api/(platform)/app/billing

app/feedback/

POST

Authenticated user feedback submission

POST /api/(platform)/app/feedback

Payment Routes (`/api/payments/`)

Payment processing and subscription management endpoints:

stripe/create-intent/

POST

Create Stripe payment intent for checkout

POST /api/payments/stripe/create-intent

lemonsqueezy/create-checkout/

POST

Create Lemon Squeezy checkout session

POST /api/payments/lemonsqueezy/create-checkout

history/

GET

Retrieve user payment history

GET /api/payments/history

Webhook Routes (`/api/webhook/`)

Webhook handlers for external service integrations:

clerk/

POST

Handle Clerk user sync webhooks

POST /api/webhook/clerk

stripe/

POST

Handle Stripe payment webhooks

POST /api/webhook/stripe

lemonsqueezy/

POST

Handle Lemon Squeezy payment webhooks

POST /api/webhook/lemonsqueezy

Service Routes

Additional service endpoints for specific functionality:

resend/send/

POST

Send emails via Resend service

POST /api/resend/send

stripe/checkout/

POST

Create Stripe checkout sessions

POST /api/stripe/checkout

API Patterns

Type Safety

Full TypeScript support with proper type definitions for all API routes

Error Handling

Consistent error responses with proper HTTP status codes

Validation

Input validation using schema validation libraries

Rate Limiting

Built-in protection against abuse and spam

Webhook Security

Signature verification for webhook authenticity

Authentication

JWT and session-based authentication support

Example API Usage

Creating a Payment Intent

JavaScript Example
const response = await fetch('/api/payments/stripe/create-intent', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
amount: 999, // $9.99
currency: 'usd',
planId: 'unlimited'
})
});

const data = await response.json();

Submitting Feedback

JavaScript Example
const feedback = {
message: 'Great product!',
rating: 5,
category: 'general'
};

const response = await fetch('/api/public/feedback', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(feedback)
});