diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 000000000..dfdd2bf88
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,21 @@
+{
+ "name": "sndev",
+ "hostRequirements": {
+ "cpus": 4,
+ "memory": "16gb",
+ "storage": "32gb"
+ },
+ "customizations": {
+ "vscode": {
+ "extensions": [
+ "ms-azuretools.vscode-containers"
+ ]
+ }
+ },
+ "containerEnv": {
+ "CPU_SHARES_IMPORTANT": "1024",
+ "CPU_SHARES_MODERATE": "512",
+ "CPU_SHARES_LOW": "128"
+ },
+ "postAttachCommand": "./sndev start"
+}
diff --git a/.devcontainer/minimal/devcontainer.json b/.devcontainer/minimal/devcontainer.json
new file mode 100644
index 000000000..8681d6fea
--- /dev/null
+++ b/.devcontainer/minimal/devcontainer.json
@@ -0,0 +1,22 @@
+{
+ "name": "sndev MINIMAL",
+ "hostRequirements": {
+ "cpus": 4,
+ "memory": "16gb",
+ "storage": "32gb"
+ },
+ "customizations": {
+ "vscode": {
+ "extensions": [
+ "ms-azuretools.vscode-containers"
+ ]
+ }
+ },
+ "containerEnv": {
+ "CPU_SHARES_IMPORTANT": "1024",
+ "CPU_SHARES_MODERATE": "512",
+ "CPU_SHARES_LOW": "128",
+ "COMPOSE_PROFILES": "minimal"
+ },
+ "postAttachCommand": "./sndev start"
+}
diff --git a/README.md b/README.md
index 6ba466410..c2143df03 100644
--- a/README.md
+++ b/README.md
@@ -167,6 +167,22 @@ To add/remove DNS records you can now use `./sndev domains dns`. More on this [h
+## GitHub Codespaces
+
+
+
+You can also develop Stacker News in GitHub Codespaces.
+
+1. **Open in Codespaces**: On the GitHub repository page, either click on the "Open in Github Codespaces" Badge or click on `Code` -> `Codespaces` in the Github UI and select the branch you would like to run the `DEFAULT` sndev Dev container configuration on.
+2. **Wait for Setup**: The Codespace will automatically build the dev container and run the `./sndev start` command. This will take a several minutes before the services are ready
+4. **Accessing Services**:
+ * Web application (app): The `app` service runs on port 3000. GitHub Codespaces should automatically forward this port. You can open it from the "Ports" tab in VS Code.
+ * Other services (database, MailHog, lnbits, etc.): will also be accessible in the ports tab, through their configured ports.
+5. **Minimal Profile for Faster Startup**: For a quicker start and less resource usage in Codespaces is available as a separate `MINIMAL` Dev container configuration, that can be selected in step 1.
+6. **Using `sndev`**: All other `sndev` commands (`./sndev logs `, `./sndev psql`, `./sndev login `, etc.) should work as described in this README.
+
+
+
# Table of Contents
- [Getting started](#getting-started)
- [Installation](#installation)
@@ -174,6 +190,7 @@ To add/remove DNS records you can now use `./sndev domains dns`. More on this [h
- [Modifying services](#modifying-services)
- [Running specific services](#running-specific-services)
- [Merging compose files](#merging-compose-files)
+ - [Github Codespaces](#Github-Codespaces)
- [Contributing](#contributing)
- [We pay bitcoin for contributions](#we-pay-bitcoin-for-contributions)
- [Pull request awards](#pull-request-awards)
diff --git a/sndev b/sndev
index fa38b2a24..83a218aef 100755
--- a/sndev
+++ b/sndev
@@ -481,6 +481,14 @@ sndev__login() {
salt="202c90943c313b829e65e3f29164fb5dd7ea3370d7262c4159691c2f6493bb8b"
# upsert user with nym and nym@sndev.team
email="$1@sndev.team"
+
+ # Detect Codespaces and set the correct base URL
+ if [ -n "$CODESPACE_NAME" ]; then
+ BASE_URL="https://${CODESPACE_NAME}-3000.app.github.dev"
+ else
+ BASE_URL="http://localhost:3000"
+ fi
+
docker__exec db psql -U sn -d stackernews -q <