Skip to content

Repository files navigation

Markdown to PDF & DOCX — Web App

A free online converter where anyone can paste or upload Markdown and download PDF or Word (.docx) files instantly.

Architecture

This project uses a split deploy:

Platform Role
Railway Runs the Python backend (FastAPI + Pandoc + WeasyPrint) via Docker
Vercel Serves the website UI and proxies /api/* requests to Railway

Vercel cannot run Pandoc/WeasyPrint in serverless functions, which is why the backend lives on Railway.

Run locally

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn app:app --reload --port 8000

Open http://localhost:8000.

Deploy to Railway (backend)

  1. Go to railway.appNew ProjectDeploy from GitHub repo.
  2. Select shihabcodes/md-converter.
  3. Railway detects the Dockerfile automatically.
  4. After deploy, open Settings → Networking → Generate Domain.
  5. Copy your public URL, e.g. https://md-converter-production.up.railway.app.
  6. Test it: visit https://YOUR-RAILWAY-URL/api/health — you should see {"status":"ok"}.

Deploy to Vercel (frontend)

  1. Go to vercel.com → import shihabcodes/md-converter.
  2. Important: set Root Directory to frontend.
  3. Add an environment variable:
    • Name: RAILWAY_API_URL
    • Value: your Railway URL (no trailing slash), e.g. https://md-converter-production.up.railway.app
  4. Deploy.

If Vercel was previously connected to the repo root, it tried to run Python serverless and crashed. Setting the root directory to frontend fixes that.

CLI usage

python convert.py examples/sample.md
python convert.py examples/sample.md --pdf
python convert.py examples/sample.md --docx

API

POST /api/convert

Form fields:

  • formatpdf or docx
  • markdown — raw Markdown text, or
  • file — uploaded .md file

Returns the converted file as a download.

Limits

  • Maximum input size: 500 KB
  • UTF-8 text only

Stack

Layer Tech
Frontend HTML, CSS, vanilla JS (Vercel)
Backend FastAPI (Railway Docker)
DOCX Pandoc
PDF Pandoc + WeasyPrint fallback

About

Free online Markdown to PDF and DOCX converter

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages