The REST server command starts a standalone Express.js server that exposes ČSFD data through HTTP endpoints.
Quick Start
Start the Server
You should see: _ __ _ _
| | / _| | | (_)
_ __ ___ __| | ___ ___ ___| |_ __| | __ _ _ __ _
| '_ \ / _ \ / _` |/ _ \ / __/ __| _/ _` | / _` | '_ \| |
| | | | (_) | (_| | __/ | (__\__ \ || (_| | | (_| | |_) | |
|_| |_|\___/ \__,_|\___| \___|___/_| \__,_| \__,_| .__/|_|
| |
|_|
[email protected]
API is running on: http://localhost:3000
Test the API
Open your browser or use curl:curl http://localhost:3000/
Available Endpoints
Root Endpoint
curl http://localhost:3000/
Movie Details
Get comprehensive information about a movie or TV series.
curl http://localhost:3000/movie/535121
Path: /movie/:id
Response language (cs, en, sk). Defaults to server configuration.
Search
Search for movies, TV series, and users.
curl http://localhost:3000/search/tarantino
Path: /search/:query
Search query (URL-encoded)
Response language (cs, en, sk)
Creator Details
Get information about actors, directors, and other creators.
curl http://localhost:3000/creator/2120
Path: /creator/:id
User Ratings
Retrieve user ratings with optional pagination and filtering.
curl http://localhost:3000/user-ratings/912-bart
Path: /user-ratings/:id
Fetch all pages (true or false)
Delay in ms between page requests (default: 0)
Comma-separated content types to include (e.g., film,series)
Comma-separated content types to exclude (e.g., episode)
User Reviews
Retrieve detailed user reviews.
curl http://localhost:3000/user-reviews/195357
Path: /user-reviews/:id
Accepts the same query parameters as /user-ratings/:id
Cinemas
Get cinema screenings (currently hardcoded to district 1, today).
curl http://localhost:3000/cinemas
Path: /cinemas
Configuration
Port Configuration
Change the server port using the PORT environment variable:
PORT=8080 npx node-csfd-api server
Language Configuration
Set a default language for all responses:
LANGUAGE=en npx node-csfd-api server
Supported languages:
cs - Czech (default)
en - English
sk - Slovak
Clients can override the default language using the ?language= query parameter on any endpoint.
API Key Protection
Protect your server with API keys:
API_KEY=your-secret-key npx node-csfd-api server
Clients must include the key in the request header:
curl -H "x-api-key: your-secret-key" http://localhost:3000/movie/535121
Multiple API Keys:
API_KEY="key1,key2,key3" npx node-csfd-api server
Custom Header Name:
API_KEY_NAME=Authorization API_KEY=secret npx node-csfd-api server
Without API key protection, your server is open to the world. Anyone can access it without restrictions.
Verbose Logging
Enable detailed request logging:
VERBOSE=true npx node-csfd-api server
This logs every successful request with timing and IP information.
Docker Deployment
Using Pre-built Image
Pull the Image
docker pull bartholomej/node-csfd-api
Run the Container
docker run -p 3000:3000 bartholomej/node-csfd-api
Access the API
curl http://localhost:3000/
With Environment Variables
docker run -p 8080:8080 \
-e PORT=8080 \
-e API_KEY=your-secret \
-e LANGUAGE=en \
bartholomej/node-csfd-api
Docker Compose
version: '3.8'
services:
csfd-api:
image: bartholomej/node-csfd-api
ports:
- "3000:3000"
environment:
- PORT=3000
- API_KEY=your-secret-key
- LANGUAGE=en
- VERBOSE=true
restart: unless-stopped
Run with:
Error Handling
The server returns structured error responses:
{
"error": "ID_MISSING",
"message": "ID is missing. Provide ID like this: /movie/1234"
}
HTTP Status Codes
| Code | Description |
|---|
200 | Success |
401 | Missing or invalid API key |
404 | Endpoint or resource not found |
500 | Server error (failed to fetch from ČSFD) |
Complete Example: Production Setup
Create .env File
PORT=3000
API_KEY=super-secret-key-change-me
API_KEY_NAME=x-api-key
LANGUAGE=en
VERBOSE=true
Start with Docker Compose
version: '3.8'
services:
csfd-api:
image: bartholomej/node-csfd-api
ports:
- "3000:3000"
env_file:
- .env
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
interval: 30s
timeout: 10s
retries: 3
Test
curl -H "x-api-key: super-secret-key-change-me" \
http://localhost:3000/search/tarantino
Next Steps
REST API Endpoints
Explore all available endpoints and responses
Docker Hub
View the official Docker image