Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
branches:
- main
jobs:
lint:
name: Lint Go
lint-test-go:
name: Lint and Test Go
runs-on: ubuntu-latest
steps:
- name: Install Go
Expand All @@ -24,18 +24,6 @@ jobs:
with:
working-directory: ./api

test:
name: Test Go
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.24

- name: Check out code
uses: actions/checkout@v4

- name: Run Tests
working-directory: ./api
run: go test -v -bench=. -race ./...
Expand All @@ -45,7 +33,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node_version: [20]
node_version: [22]

steps:
- name: Check out code
Expand Down
42 changes: 16 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,53 +266,43 @@ http://localhost:9900/app/surveys/{SURVEY_ID}/sessions?limit=100&offset=0&sort_b

Where `{SURVEY_ID}` id the UUID of a given survey.

## Screenshots

<p align="center" width="100%">
<img src="https://github.com/plutov/formulosity/blob/main/screenshots/app.png" hspace="10" height="200px">
<img src="https://github.com/plutov/formulosity/blob/main/screenshots/survey.png" hspace="10" height="200px">
</p>

## Installation & Deployment

You can build and run both API and UI with Docker Compose:
### API and Postgres with Docker Compose

You can build and run both API and Postgres with Docker Compose:

```
docker-compose up -d --build
```

And you should be able to access the UI on [localhost:3000](http://localhost:3000) (default basic auth: `user:pass`).

You can deploy individual services to any cloud provider or self host them.

- Go backend.
- Next.js frontend.
- Postgres database.

### Environment Variables
Environment variables:
Comment on lines 275 to +279
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix fenced code block languages and a grammar nit.

Add explicit languages to fenced blocks and adjust wording (“a mounted volume”).

-```
+```bash
 docker-compose up -d --build

...
- +bash
cd ui
npm install
npm run dev

...
-```
+```bash
cd api
export DATABASE_URL="postgres://user:pass@localhost:5432/formulosity?sslmode=disable"
export SURVEYS_DIR="./surveys"
go run main.go

-... It's suggested to use mounted volume for this directory.
+... It's suggested to use a mounted volume for this directory.



Also applies to: 289-293, 299-305, 284-284

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.17.2)</summary>

275-275: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

In README.md around lines 275-279 (also apply same changes to 284, 289-293, and
299-305), update the fenced code blocks to include explicit languages (e.g.,
bash) for each triple-backtick block and change the grammar nit by replacing
“It's suggested to use mounted volume for this directory.” with “It's suggested
to use a mounted volume for this directory.”; ensure each code block opening
fence has the correct language tag and the corrected sentence appears where
referenced.


</details>

<!-- fingerprinting:phantom:medusa:chinchilla -->

<!-- This is an auto-generated comment by CodeRabbit -->


API:

- `DATABASE_URL` - Postgres connection string
- `SURVEYS_DIR` - Directory with surveys, e.g. `/root/surveys`. It's suggested to use mounted volume for this directory.
- `UPLOADS_DIR` - Directory for uploading files from the survey forms.

UI:

- `CONSOLE_API_ADDR` - Public address of the Go backend. Need to be accessible from the browser.
- `CONSOLE_API_ADDR_INTERNAL` - Internal address of the Go backend, e.g. `http://api:8080` (could be the same as `CONSOLE_API_ADDR`).
- `IRON_SESSION_SECRET` - Secret for session encryption
- `HTTP_BASIC_AUTH` - Format: `user:pass` for basic auth (optional)

### Run UI with npm

It's also possible to run UI using `npm`:

```
cd ui
npm install
npm run dev
```

### Run API locally

Assuming you have Postgres running locally (`docker-compose up -d postgres`), you can run the API with:

```
cd api
export DATABASE_URL="postgres://user:pass@localhost:5432/formulosity?sslmode=disable"
export SURVEYS_DIR="./surveys"
go run main.go
```

## Tech Stack

- Backend: Go, Postgres
Expand Down
13 changes: 0 additions & 13 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,6 @@ services:
volumes:
- ./api/surveys:/root/surveys
- ./api/uploads:/root/uploads
ui:
restart: always
build:
context: ./ui
ports:
- "3000:3000"
environment:
- CONSOLE_API_ADDR_INTERNAL=http://api:8080
- CONSOLE_API_ADDR=http://localhost:9900
- IRON_SESSION_SECRET=e75af92dffba8065f2730472f45f2046941fe35f361739d31992f42d88d6bf6c
- HTTP_BASIC_AUTH=user:pass
depends_on:
- api
postgres:
image: postgres:16.0-alpine
restart: always
Expand Down
Binary file removed screenshots/app.png
Binary file not shown.
Binary file removed screenshots/survey.png
Binary file not shown.
3 changes: 1 addition & 2 deletions ui/.env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CONSOLE_API_ADDR=http://localhost:9900
CONSOLE_API_ADDR_INTERNAL=http://localhost:9900
NEXT_PUBLIC_API_ADDR=http://localhost:9900
IRON_SESSION_SECRET=not_very_secret_replace_me
HTTP_BASIC_AUTH=user:pass

41 changes: 0 additions & 41 deletions ui/Dockerfile

This file was deleted.

Loading
Loading