Skip to content
vic

Gabriella439/simple-twitter

A bare-bones Twitter clone implemented in a single file

Gabriella439/simple-twitter.json
{
"createdAt": "2019-10-12T20:56:39Z",
"defaultBranch": "main",
"description": "A bare-bones Twitter clone implemented in a single file",
"fullName": "Gabriella439/simple-twitter",
"homepage": null,
"language": "Nix",
"name": "simple-twitter",
"pushedAt": "2025-04-09T22:33:34Z",
"stargazersCount": 730,
"topics": [],
"updatedAt": "2025-10-29T08:40:02Z",
"url": "https://github.com/Gabriella439/simple-twitter"
}

This is a project which has corresponding talk slides

This is a bare bones “Twitter clone” implemented in [a single file]!(./simple-twitter.nix) that you can deploy to EC2

This uses:

The result looks like this:

Screenshot

  1. Create an AWS account

    … by following these instructions

  2. Install Nix:

    Terminal window
    $ curl https://nixos.org/nix/install | sh
  3. Install the AWS command-line interface:

    Terminal window
    $ nix-env --install awscli
  4. Configure your AWS credentials

    … by following these instructions

    If you did this correctly you should have an ~/.aws/credentials file that looks similar to this:

    [default]
    aws_access_key_id = …
    aws_secret_access_key = …
  5. Install NixOps:

    Terminal window
    $ nix-env --install nixops
  6. Build and redeploy the web application

    Terminal window
    $ nixops create --deployment simple-twitter simple-twitter.nix
    $ nixops deploy --deployment simple-twitter --allow-reboot

If you make changes you can redeploy the application by re-running the last step:

Terminal window
$ nixops deploy --deployment simple-twitter --allow-reboot

To destroy the machine and clean up everything, run:

Terminal window
$ nixops destroy --deployment simple-twitter
$ nixops delete --deployment simple-twitter

Have fun! 🙂

You can also view the files split out by language:

  • [./split.nix]!(./split.nix) - Only the Nix code
  • [./Main.hs]!(./Main.hs) - Only the Haskell code
  • [./initialScript.sql]!(./initialScript.sql) - Only the SQL code