Appearance
API Services Documentation ​
Overview ​
The API services directory (api/) contains server-side Express.js endpoints that handle various backend operations, including file uploads, cloud storage integrations, payment processing, and search functionality.
API Structure ​
All API endpoints are mounted as server middleware in nuxt.config.js:
javascript
serverMiddleware: [
{ path: '/api', handler: '~/api/index.js' },
{ path: '/s3', handler: '~/api/s3.js' },
{ path: '/driveapi', handler: '~/api/drive-api.js' },
{ path: '/box', handler: '~/api/box.js' },
{ path: '/zip', handler: '~/api/zip-viewer.js' },
{ path: '/convert', handler: '~/api/media-converter' },
{ path: '/stripe', handler: '~/api/payments.js' },
{ path: '/typesense', handler: '~/api/typesense.js' },
// ... more endpoints
]API Services ​
Main API ​
- Path:
api/index.js - Base Path:
/api - Purpose: General API endpoints
Endpoints ​
GET /api/browser-os- Get browser and OS informationGET /api/image-proxy- Proxy images from external URLsPOST /api/upload-asset- Upload asset via server
S3 Service ​
- Path:
api/s3.js - Base Path:
/s3 - Purpose: AWS S3 file storage operations
Endpoints ​
GET /s3/getBucketConfig- Get S3 bucket CORS configurationPOST /s3/updateBucketConfig- Update S3 bucket CORS configurationGET /s3/start-upload- Initiate multipart uploadGET /s3/get-upload-url- Get presigned URL for chunk uploadPOST /s3/complete-upload- Complete multipart uploadGET /s3/download- Download file from S3DELETE /s3/delete- Delete file from S3
Google Drive API ​
- Path:
api/drive-api.js - Base Path:
/driveapi - Purpose: Google Drive integration
Endpoints ​
GET /driveapi/auth- Initiate Google Drive authenticationGET /driveapi/callback- Handle OAuth callbackGET /driveapi/files- List Drive filesPOST /driveapi/upload- Upload to DriveGET /driveapi/download- Download from Drive
Dropbox API ​
- Path:
api/dropbox.js(if exists) - Base Path:
/dropbox - Purpose: Dropbox integration
Box API ​
- Path:
api/box.js - Base Path:
/box - Purpose: Box.com integration
Endpoints ​
GET /box/auth- Initiate Box authenticationGET /box/callback- Handle OAuth callbackGET /box/files- List Box filesPOST /box/upload- Upload to Box
Typesense API ​
- Path:
api/typesense.js - Base Path:
/typesense - Purpose: Search engine integration
Endpoints ​
POST /typesense/search-assets- Search assetsPOST /typesense/search-folders- Search foldersPOST /typesense/search-collages- Search collagesGET /typesense/suggestions- Get search suggestions
Payment API ​
- Path:
api/payments.js - Base Path:
/stripe - Purpose: Stripe payment processing
Endpoints ​
POST /stripe/create-checkout- Create checkout sessionPOST /stripe/webhook- Handle Stripe webhooksGET /stripe/subscription- Get subscription details
Media Converter ​
- Path:
api/media-converter/index.js - Base Path:
/convert - Purpose: Media file conversion
Endpoints ​
POST /convert/video- Convert video formatPOST /convert/image- Convert image formatGET /convert/status/:id- Get conversion status
Zip Viewer ​
- Path:
api/zip-viewer.js - Base Path:
/zip - Purpose: ZIP file handling
Endpoints ​
GET /zip/list- List ZIP contentsGET /zip/extract- Extract ZIP fileGET /zip/download- Download ZIP file
Shared Assets API ​
- Path:
api/shared/index.js - Base Path:
/shared - Purpose: Shared asset operations
Universal Link API ​
- Path:
api/universal-link.js - Base Path:
/apple-app-site-association - Purpose: iOS universal links
Image Generation API ​
- Path:
api/generate-image.js - Base Path:
/generate-image - Purpose: AI image generation
Phone Number API ​
- Path:
api/phone-number.js - Base Path:
/phone-number - Purpose: Phone number validation
Authentication ​
Most API endpoints require authentication:
- Token-based authentication via
Authorizationheader - Token validation against backend API
- User workspace validation
Error Handling ​
All endpoints implement consistent error handling:
javascript
try {
// API logic
res.send({ success: true, data: result })
} catch (error) {
res.status(500).send({
error: error.message,
stack: process.env.NODE_ENV === 'development' ? error.stack : undefined
})
}CORS Configuration ​
All endpoints support CORS:
javascript
app.use(cors({
origin: '*',
exposedHeaders: 'ETAG',
allowedHeaders: '*'
}))Environment Variables ​
API services require these environment variables:
AWS_ACCESS_KEY_ID- AWS access keyAWS_SECRET_ACCESS_KEY- AWS secret keyAWS_BUCKET- S3 bucket nameAWS_DEFAULT_REGION- AWS regionGOOGLE_DRIVE_CLIENT_ID- Google Drive client IDGOOGLE_DRIVE_CLIENT_SECRET- Google Drive secretSTRIPE_SECRET_KEY- Stripe secret keyTYPESENSE_HOST- Typesense hostTYPESENSE_API_KEY- Typesense API key
Related Documentation ​
- S3 Service Details - AWS S3 integration
- API Overview - All API services