Skip to content

Serving a Downloaded Project

David Foster edited this page Aug 18, 2025 · 3 revisions

Crystal can be run as a headless server that where you can use a web browser to view the contents of a downloaded project:

$ crystal --serve --headless MyDownloadedWebsite.crystalproj
Server started at: http://127.0.0.1:2797
Press Ctrl-C to stop.

By default served projects can only be accessed on the same computer where Crystal is running. If you want to make a served project available to any other computer on the same network, use --host 0.0.0.0:

$ crystal --serve --headless --host 0.0.0.0 MyDownloadedWebsite.crystalproj
Server started at: http://0.0.0.0:2797
Read-only mode automatically enabled for remote access (--host 0.0.0.0).
To allow remote modifications, restart with --no-readonly.
Press Ctrl-C to stop.

You can also customize the --port that Crystal is served on:

$ crystal --serve --headless --host 0.0.0.0 --port 8080 MyDownloadedWebsite.crystalproj
Server started at: http://0.0.0.0:8080
Read-only mode automatically enabled for remote access (--host 0.0.0.0).
To allow remote modifications, restart with --no-readonly.
Press Ctrl-C to stop.

Projects are served as --readonly by default when made available to remote computers. To allow remote modifications, specify --no-readonly:

$ crystal --serve --headless --host 0.0.0.0 --port 8080 --no-readonly MyDownloadedWebsite.crystalproj
Server started at: http://0.0.0.0:8080
Press Ctrl-C to stop.
Clone this wiki locally