Skip to content

Repository files navigation

Rocket Launch EU API

Go Version License API PRs Welcome

Go REST API for upcoming European rocket launch data with authentication and location filtering.

⚠️ Development API Notice This project currently uses the ThespaceDevs development API (lldev.thespacedevs.com). Not intended for production use. For production deployments, switch to the production API endpoint and obtain a proper API key from ThespaceDevs.

Quick Start

# 1. Clone and setup
git clone git@github.com:r3morce/rleu-api.git
cd rleu-api
cp .env.example .env

# 2. Generate API key
uuidgen  # Copy the output

# 3. Edit .env and add your key
RLEU_API_KEY=your-key-here

# 4. Run
go run ./cmd/server

# 5. Test (use your actual key)
curl -H "Authorization: Bearer YOUR_API_KEY" http://localhost:8080/launches

Setup

Requirements

Configuration

Create .env file:

RLEU_API_KEY=your-generated-uuid-here  # Required for auth
DEBUG=false                             # Set to true to skip auth

Edit config/config.yaml for API settings:

api:
  limit: 5                    # Number of launches to fetch

server:
  port: 8080                  # Server port

european_pads:
  enabled: true               # Filter European launches only

Build & Run

# Development (with hot reload)
go run ./cmd/server

# Production build
go build -o rleu-api ./cmd/server
./rleu-api

# Debug mode (no authentication)
DEBUG=true go run ./cmd/server

API Usage

Authentication

Include API key in Authorization header:

curl -H "Authorization: Bearer YOUR_API_KEY" http://localhost:8080/launches

Endpoints

GET /launches - Get upcoming launches

  • Returns 5 upcoming launches
  • European filtering if enabled in config
  • Requires authentication (unless DEBUG=true)

Response:

{
  "count": 1,
  "results": [{
    "id": "...",
    "name": "Falcon 9 | Starlink",
    "net": "2025-11-22T23:41:00Z",
    "status": { "name": "Go for Launch" }
  }]
}

Development

Debug Mode

DEBUG=true ./rleu-api
curl http://localhost:8080/launches  # No auth needed

Debug features:

  • ✓ Authentication disabled
  • ✓ API throttle monitoring
  • ✓ Detailed logging

⚠️ Never use DEBUG=true in production

Project Structure

rleu-api/
├── cmd/server/main.go       # HTTP server & auth
├── internal/launches/       # API client & models
├── config/                  # Configuration
└── .env                     # Your secrets (git-ignored)

Deployment

Fly.io (Recommended)

Deploy to Fly.io with automatic HTTPS and European hosting:

# 1. Install Fly CLI
curl -L https://fly.io/install.sh | sh

# 2. Login
fly auth login

# 3. Launch app (follow prompts)
fly launch

# 4. Set your API key as a secret
fly secrets set RLEU_API_KEY=your-generated-uuid-here

# 5. Deploy
fly deploy

# 6. Check status
fly status

# Your API will be available at: https://rleu-api.fly.dev

Configuration:

  • Region: Amsterdam (ams) - European data center
  • Auto HTTPS with Let's Encrypt certificates
  • Auto-scaling: scales to zero when idle (free tier friendly)
  • Health checks on /launches endpoint

Update deployment:

fly deploy

View logs:

fly logs

Docker

With Docker Compose (recommended for local development):

# Start (reads .env file automatically)
docker-compose up

# Start in background
docker-compose up -d

# View logs
docker-compose logs -f

# Stop
docker-compose down

# Rebuild and start
docker-compose up --build

With Docker directly:

# Build
docker build -t rleu-api .

# Run
docker run -p 8080:8080 -e RLEU_API_KEY=your-key-here rleu-api

# Run in debug mode
docker run -p 8080:8080 -e RLEU_API_KEY=your-key-here -e DEBUG=true rleu-api

Test:

curl -H "Authorization: Bearer your-key-here" http://localhost:8080/launches

Data: ThespaceDevs Launch Library

About

A lightweight Go API that provides filtered European rocket launch data from ThespaceDevs

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages