---
title: "Deploy TorchCode"
description: "LeetCode-style PyTorch practice in JupyterLab with instant auto-grading"
category: "AI/ML"
url: https://railway.com/deploy/torchcode-1
---

# Deploy TorchCode

LeetCode-style PyTorch practice in JupyterLab with instant auto-grading

**[Deploy TorchCode on Railway](https://railway.com/template/torchcode-1)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/torchcode-1/manifest.json

- **Creator:** zer0person's Projects
- **Category:** AI/ML
- **Total deploys:** 1

## Template content

### TorchCode

- **Image:** ghcr.io/duoan/torchcode:latest
- **Start command:** `sh -c 'sed "s/--NotebookApp\.token=..//" /app/entrypoint.sh > /tmp/entrypoint.sh && exec bash /tmp/entrypoint.sh'`
- **Public domain:** Yes

## Documentation

# Deploy and Host TorchCode on Railway

[TorchCode](https://github.com/duoan/TorchCode) is a self-hosted practice platform for PyTorch: implement softmax, attention, GPT-2 blocks and more from scratch in Jupyter notebooks and get instant auto-grading. No GPU is needed.

## About Hosting TorchCode

This template runs the official `ghcr.io/duoan/torchcode:latest` image (JupyterLab with the problem notebooks and the grader) with a persistent volume at `/app/data`. JupyterLab can run code on the server, so it is protected with a generated access token: open the service Variables tab, copy `JUPYTER_TOKEN`, then open `https:///?token=`. The blank notebooks are reset to their templates on every restart, so keep a copy of work you want to keep.

## Common Use Cases

- Prepare for ML engineer interviews by coding operators from scratch
- Run a shared practice environment for a study group or team
- Teach PyTorch fundamentals with graded exercises

## Dependencies for TorchCode Hosting

- One service with a volume; CPU only, no external database

### Deployment Dependencies

- [TorchCode on GitHub](https://github.com/duoan/TorchCode)
- [Container image](https://github.com/duoan/TorchCode/pkgs/container/torchcode)

## Why Deploy TorchCode on Railway?

Railway gives you a public HTTPS URL, a persistent volume and automatic restarts with no server to maintain.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius v0.1 Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/torchcode-1
