Skip to content

Commit 8c2e3d7

Browse files
authored
Merge pull request #49 from plutov/vuejs-ui
client-only
2 parents d55c0b0 + 467c0e4 commit 8c2e3d7

File tree

24 files changed

+370
-898
lines changed

24 files changed

+370
-898
lines changed

.github/workflows/test.yaml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ on:
77
branches:
88
- main
99
jobs:
10-
lint:
11-
name: Lint Go
10+
lint-test-go:
11+
name: Lint and Test Go
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Install Go
@@ -24,18 +24,6 @@ jobs:
2424
with:
2525
working-directory: ./api
2626

27-
test:
28-
name: Test Go
29-
runs-on: ubuntu-latest
30-
steps:
31-
- name: Install Go
32-
uses: actions/setup-go@v5
33-
with:
34-
go-version: 1.24
35-
36-
- name: Check out code
37-
uses: actions/checkout@v4
38-
3927
- name: Run Tests
4028
working-directory: ./api
4129
run: go test -v -bench=. -race ./...
@@ -45,7 +33,7 @@ jobs:
4533
runs-on: ubuntu-latest
4634
strategy:
4735
matrix:
48-
node_version: [20]
36+
node_version: [22]
4937

5038
steps:
5139
- name: Check out code

README.md

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -266,53 +266,43 @@ http://localhost:9900/app/surveys/{SURVEY_ID}/sessions?limit=100&offset=0&sort_b
266266

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

269-
## Screenshots
270-
271-
<p align="center" width="100%">
272-
<img src="https://github.com/plutov/formulosity/blob/main/screenshots/app.png" hspace="10" height="200px">
273-
<img src="https://github.com/plutov/formulosity/blob/main/screenshots/survey.png" hspace="10" height="200px">
274-
</p>
275-
276269
## Installation & Deployment
277270

278-
You can build and run both API and UI with Docker Compose:
271+
### API and Postgres with Docker Compose
272+
273+
You can build and run both API and Postgres with Docker Compose:
279274

280275
```
281276
docker-compose up -d --build
282277
```
283278

284-
And you should be able to access the UI on [localhost:3000](http://localhost:3000) (default basic auth: `user:pass`).
285-
286-
You can deploy individual services to any cloud provider or self host them.
287-
288-
- Go backend.
289-
- Next.js frontend.
290-
- Postgres database.
291-
292-
### Environment Variables
279+
Environment variables:
293280

294281
API:
295282

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

300-
UI:
301-
302-
- `CONSOLE_API_ADDR` - Public address of the Go backend. Need to be accessible from the browser.
303-
- `CONSOLE_API_ADDR_INTERNAL` - Internal address of the Go backend, e.g. `http://api:8080` (could be the same as `CONSOLE_API_ADDR`).
304-
- `IRON_SESSION_SECRET` - Secret for session encryption
305-
- `HTTP_BASIC_AUTH` - Format: `user:pass` for basic auth (optional)
306-
307287
### Run UI with npm
308288

309-
It's also possible to run UI using `npm`:
310-
311289
```
290+
cd ui
312291
npm install
313292
npm run dev
314293
```
315294
295+
### Run API locally
296+
297+
Assuming you have Postgres running locally (`docker-compose up -d postgres`), you can run the API with:
298+
299+
```
300+
cd api
301+
export DATABASE_URL="postgres://user:pass@localhost:5432/formulosity?sslmode=disable"
302+
export SURVEYS_DIR="./surveys"
303+
go run main.go
304+
```
305+
316306
## Tech Stack
317307
318308
- Backend: Go, Postgres

compose.yaml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,6 @@ services:
1414
volumes:
1515
- ./api/surveys:/root/surveys
1616
- ./api/uploads:/root/uploads
17-
ui:
18-
restart: always
19-
build:
20-
context: ./ui
21-
ports:
22-
- "3000:3000"
23-
environment:
24-
- CONSOLE_API_ADDR_INTERNAL=http://api:8080
25-
- CONSOLE_API_ADDR=http://localhost:9900
26-
- IRON_SESSION_SECRET=e75af92dffba8065f2730472f45f2046941fe35f361739d31992f42d88d6bf6c
27-
- HTTP_BASIC_AUTH=user:pass
28-
depends_on:
29-
- api
3017
postgres:
3118
image: postgres:16.0-alpine
3219
restart: always

screenshots/app.png

-178 KB
Binary file not shown.

screenshots/survey.png

-322 KB
Binary file not shown.

ui/.env.example

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
CONSOLE_API_ADDR=http://localhost:9900
2-
CONSOLE_API_ADDR_INTERNAL=http://localhost:9900
1+
NEXT_PUBLIC_API_ADDR=http://localhost:9900
32
IRON_SESSION_SECRET=not_very_secret_replace_me
43
HTTP_BASIC_AUTH=user:pass
54

ui/Dockerfile

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)