A custom Swiss Ephemeris REST API server built for Google Apps Script integration. Provides planetary positions, house cusps, and chart data with Swiss Ephemeris accuracy.
- Go to https://github.com/new
- Name it:
swisseph-api - Make it Public (required for Railway free tier)
- Click "Create repository"
From your terminal in this directory:
cd /Users/lisa/swisseph/swisseph-api-server
# Initialize git
git init
# Add all files
git add .
# Commit
git commit -m "Initial commit: Swiss Ephemeris API"
# Add your GitHub repo (replace YOUR_USERNAME)
git remote add origin https://github.com/YOUR_USERNAME/swisseph-api.git
# Push to GitHub
git branch -M main
git push -u origin main- Go to: https://railway.app
- Sign up with GitHub (free)
- Click: "New Project"
- Select: "Deploy from GitHub repo"
- Choose: Your
swisseph-apirepository - Railway will automatically:
- Detect Node.js
- Run
npm install - Start the server
- Give you a public URL
- In Railway, click on your deployment
- Go to Settings tab
- Click Generate Domain under "Networking"
- Copy your URL:
https://swisseph-api-production.up.railway.app
Done! Your API is live! 🎉
https://your-app.railway.app
Endpoint: POST /api/planets
Request Body:
{
"year": 1967,
"month": 4,
"day": 17,
"hour": 6,
"min": 40,
"lat": 40.8928,
"lon": -73.9734
}Response:
{
"sun": {
"longitude": 27.123456,
"full_degree": 27.123456,
"sign": "Aries",
"degree": 27.123456,
"speed": 1.0,
"isRetro": "false"
},
"moon": { ... },
...
}Endpoint: POST /api/houses
Request Body:
{
"year": 1967,
"month": 4,
"day": 17,
"hour": 6,
"min": 40,
"lat": 40.8928,
"lon": -73.9734,
"house_type": "placidus"
}House Types: placidus, whole_sign, koch, equal, campanus
Response:
{
"ascendant": {
"longitude": 0.123456,
"full_degree": 0.123456,
"sign": "Aries",
"degree": 0.123456
},
"house1": { ... },
"house2": { ... },
...
"house12": { ... }
}Endpoint: POST /api/chart
Request Body: Same as /api/planets
Response:
{
"planets": { ... },
"houses": { ... }
}Railway Free Tier:
- $5 USD free credit every month
- Enough for 500,000+ requests
- Execution time: 500 hours/month
- Perfect for personal use!
If you exceed free tier: ~$0.000001 per request
Once deployed, test with:
curl -X POST https://your-app.railway.app/api/planets \
-H "Content-Type: application/json" \
-d '{
"year": 1967,
"month": 4,
"day": 17,
"hour": 6,
"min": 40,
"lat": 40.8928,
"lon": -73.9734
}'Or visit: https://your-app.railway.app in browser to see status.
# Install dependencies
npm install
# Start server
npm start
# Server runs at http://localhost:3000After deployment:
- Copy your Railway URL
- Update Google Apps Script files with your URL
- Test with sample chart
- Deploy your charts!
- Make sure all files are committed to GitHub
- Check Railway logs for error messages
- Make sure you generated a domain in Railway settings
- Check if deployment is "Active"
- Test locally first:
npm start - Check server logs in Railway dashboard
- ✅ Swiss Ephemeris accuracy
- ✅ All major planets + asteroids
- ✅ Multiple house systems
- ✅ Fast responses (~50ms)
- ✅ CORS enabled
- ✅ JSON responses
- ✅ Error handling
- ✅ Free hosting
MIT - Use freely for personal or commercial projects