Cron Jobs on Railway
Before native cron support existed, Railway cron jobs could be run as an ordinary long-lived service that schedules work with a language-level library. The example scaffolds a TypeScript package with DTS, uses node-cron to log a message every minute, points the start script at the built dist output, and deploys with `railway up` without extra configuration. An update notes that Railway now offers native Cron Jobs, which may be the better option.
Related posts
- Cron Jobs with Django and GitHub Actions
Railway mediumAdeptScheduled Django management commands can run against a Railway project by using a GitHub Actions workflow on a cron schedule. The workflow checks out the repo, installs the Railway CLI via npm, and uses `railway run --service` with a project-scoped RAILWAY_TOKEN secret to install requirements and execute `python manage.py my_command` in the service's environment. An August 2023 update notes that Railway now supports cron jobs natively, which may be the better option.
- One-Second Deploys? We Didn’t Believe It Either
Railway easyNoviceRailway Functions, now generally available, deploy single-file TypeScript code onto Railway's container compute in about a second, without a package.json, Git repo, IaC or container build. The pipeline parses source into an AST to infer dependencies and generates package.json on the fly, with versions pinnable directly in import specifiers. Dependencies are installed with `bun install`, which installs fastify in 500ms compared with over 6s for npm, pnpm and yarn without a lockfile. Bun then runs the TypeScript directly with no transpile or bundle step. Functions share Services' features such as volumes and variables.
- Deploy Full-Stack TypeScript Apps: Architectures, Execution Models, and Deployment Choices
Railway easyNoviceFull-stack TypeScript apps can be structured either as a single framework codebase (Next.js, SvelteKit, TanStack Start) or as independently deployed services in a monorepo, and the choice interacts with whether you deploy to serverless platforms or long-running servers. Serverless (Cloudflare Workers, Vercel) gives automatic scaling and no infrastructure management, but imposes stateless, instance-scoped globals, 128 MB memory and CPU-time caps on Workers, and no persistent connections. That rules out ETL, media processing, WebSocket chat and live dashboards. Long-running servers keep in-memory state, open connections and arbitrary protocols, at the cost of capacity planning. Railway pitches itself as offering those server semantics with usage-based billing and managed infrastructure.
- Run Scheduled and Recurring Tasks with Cron
Railway mediumAdeptCron runs commands on time-based schedules but keeps no job history, has no retries and does no concurrency control, so reliability depends on the job itself. The guide covers the five-field schedule syntax, including the day-of-month/weekday OR pitfall and timezone/DST issues, and recommends idempotent upserts, structured start/success/error logs, explicit connection cleanup, and Postgres advisory locks to prevent overlapping runs. On Railway, cron triggers a service's start command in UTC with a 5-minute minimum interval and a single active execution. A process left alive by open handles or pending promises causes later runs to be skipped.
- Implement a GitHub Actions Testing Suite
Railway mediumAdeptWalkthrough of building a CI test suite with GitHub Actions for a TypeScript Fastify API deployed on Railway. A /weekday route is added and covered with Vitest integration tests. A workflow runs on PRs and pushes to main, building the app, starting it in the background, then running the tests. Branch rulesets make the passing check required before merge, and Railway's 'wait for CI' setting stops failing commits from auto-deploying. Closing notes point to concurrency, matrix builds and caching as ways to scale the pipeline.