Development: http://localhost:13000
Production: https://your-app-name.herokuapp.com
All API endpoints (except /health) require authentication via session cookies. Users must be logged in to access these endpoints.
Check if the server is running and healthy.
Authentication Required: No
Response:
{
"status": "healthy",
"timestamp": "2024-01-15T10:30:00.000Z",
"uptime": 3600.5
}Status Codes:
200 OK- Server is healthy
Generate a new AI animation from a text prompt.
Authentication Required: Yes
Rate Limit: 10 requests per 15 minutes per IP
Request Body:
{
"userPrompt": "White tiger walking in New York City"
}Request Validation:
userPromptmust be a non-empty string- Maximum length: 500 characters
- Minimum length: 1 character (after trimming)
Success Response (200 OK):
{
"success": true,
"message": "Video generated successfully!",
"video": {
"id": 42,
"url": "https://storage.googleapis.com/.../video.mp4",
"prompt": "White tiger walking in New York City"
}
}Error Responses:
400 Bad Request - Invalid input:
{
"success": false,
"error": "Please provide a valid text prompt"
}429 Too Many Requests - Rate limit exceeded:
{
"success": false,
"error": "Too many video generation requests, please try again later."
}502 Bad Gateway - External API error:
{
"success": false,
"error": "External API error. Please try again later."
}500 Internal Server Error - Server error:
{
"success": false,
"error": "Failed to generate video. Please try again."
}Delete a video from the user's gallery.
Authentication Required: Yes
URL Parameters:
id(integer) - The ID of the video to delete
Success Response (200 OK):
{
"success": true,
"message": "Video deleted successfully"
}Error Responses:
404 Not Found - Video not found or doesn't belong to user:
{
"success": false,
"error": "Video not found"
}500 Internal Server Error:
{
"success": false,
"error": "Failed to delete video"
}View user profile with paginated video gallery.
Authentication Required: Yes
Query Parameters:
page(integer, optional) - Page number for pagination (default: 1)
Response: Renders the profile.ejs template with user data and video gallery.
Variables passed to template:
id- User IDname- User nameemail- User emailvideoArray- Array of user's videoscurrentPage- Current page numbertotalPages- Total number of pageshasNextPage- Boolean, true if more pages existhasPrevPage- Boolean, true if previous pages exist
Pagination:
- 12 videos per page
- Videos ordered by creation date (newest first)
Landing page with hero section and features.
User registration page.
Create new user account.
User login page.
Authenticate user.
Log out current user.
Edit profile page for user.
Update user profile information.
{
id: Integer (Primary Key),
userId: Integer (Foreign Key),
videoUrl: String,
videoName: String,
status: String (default: 'completed'),
createdAt: Date
}{
id: Integer (Primary Key),
name: String (1-99 characters),
email: String (unique, valid email),
password: String (8-99 characters, bcrypt hashed),
createdAt: Date,
updatedAt: Date
}All API endpoints return JSON error responses with appropriate HTTP status codes:
400- Bad Request (validation errors)401- Unauthorized (not logged in)404- Not Found429- Too Many Requests (rate limit)500- Internal Server Error502- Bad Gateway (external API issues)
- Helmet.js - Security headers
- Rate Limiting - 10 requests per 15 minutes for video generation
- Input Validation - All user inputs are validated and sanitized
- Session-based Authentication - Secure cookie sessions
- Password Hashing - bcrypt with 12 rounds
- Content Security Policy - Restricts resource loading
Required environment variables:
SECRET_SESSION=your_session_secret_here
GOOEY_API_KEY=your_gooey_api_key_here
DATABASE_URL=postgres://... (production only)
NODE_ENV=development|production
PORT=13000 (optional, defaults to 13000)
| Endpoint | Limit | Window |
|---|---|---|
POST /api |
10 requests | 15 minutes |
Gooey.AI DeforumSD API
- Base URL:
https://api.gooey.ai/v2/DeforumSD/ - Authentication: Bearer token
- Used for AI animation generation
Application uses Winston logger with the following transports:
- Development: Console output with colors
- Production: File logging to
logs/directoryerror.log- Error level logscombined.log- All logs
Run tests with:
npm testTests cover:
- Authentication flows
- User model validation
- Profile routes
- Video generation (with mocked API)