Skip to content

Quickstart ​

Create a small HTTP app, send it a request, and run its tests. GoForj is available in public beta.

Prerequisites ​

You need Go 1.26 or newer and a shell. The CLI and Web API components run directly on your machine.

Install GoForj ​

bash
go install github.com/goforj/goforj/cmd/forj@latest
forj --version

If your shell reports forj: command not found, add Go's binary directory to PATH and run forj --version again.

bash
export PATH="$(go env GOPATH)/bin:$PATH"

Generate the Project ​

bash
forj new

Name the Project photodrop and accept the suggested module path. On the Components screen, press c, then select Web API. CLI stays selected. Choose Skip at the Atlas prompt and use photodrop as the destination. Accept the other defaults.

When the wizard reports a successful render, enter the directory containing .goforj.yml.

bash
cd photodrop

Start the App ​

Port 3000

If port 3000 is busy, set API_HTTP_PORT in .env to a free port. Use that port in the requests below and in the next guide.

From the Project root, start the development loop:

bash
forj dev

The first build downloads Go modules before compiling the app. Wait for Dev ready. The line below it gives your app's URL, which looks like this with the default port.

text
✔ Dev ready
  → App: http://localhost:3000

Leave forj dev running.

Make the First Request ​

In a second terminal, run this from the Project root.

bash
curl http://localhost:3000/-/health
# {"status":"ok"}

List the Routes ​

From the same terminal, list the routes registered by the default App.

bash
forj route:list

Look for /-/health in the route table.

The forj shorthand runs App commands from your current source.

From sourceFrom a built binary
forj route:list./bin/app route:list
forj admin route:list./bin/admin route:list

Run the First Test ​

In the same terminal, run the generated tests.

bash
go test ./...

A successful run reports ok or [no test files] for each package.

Next Steps ​

Keep forj dev running and add your first route in this Project. The guide shows where the controller, service, and test go and how the app wires them together.