A form builder full-stack app built with Next.js, Express, Prisma, and PostgreSQL.
Live demo of the application is available on Railway:
https://form-management-demo.up.railway.app
https://form-management-demo-development.up.railway.app
The goal of this project is to create a simple form builder application that allows an admin user to create forms with sections and fields, and a public user to fill out these forms without needing to log in.
- Admin can create forms with multiple sections and fields.
- Admin can share a URL for the form.
- Public users can fill out the form without logging in.
- The project uses Docker for containerization to ensure a consistent development environment.
- The project uses Turbo for monorepo management to streamline development and build processes.
- The backend is built with Express.js and Prisma, using PostgreSQL as the database.
- The frontend is built with Next.js and Tailwind CSS.
- The project uses ESLint and Prettier for code quality and formatting.
- The project uses TypeScript for type safety and a better developer experience.
- The project includes a few unit tests for the backend and Playwright end-to-end tests for the frontend. These are for demonstration purposes and are not exhaustive.
- The project uses GitHub Actions for continuous integration and deployment (CI/CD).
The project is complex with multiple components. Accomplishing it in the proposed time seemed impossible, so I implemented the core features within the time frame and added the nice-to-have features listed above as time allowed.
- Add JSDoc comments to functions and classes.
- Complete API CRUD operations for forms, sections, and fields.
- Allow admin to edit forms, sections, and fields.
- Improve the UI/UX of the form builder and form-filling experience.
- Add live demo, deploy to Railway.
- Add more unit tests for the backend.
- Add frontend component tests.
- Add more end-to-end tests for the frontend.
Due to time constraints, for the sake of simplicity, the tokens for the forms are automatically generated and not managed by the admin.
- Docker and Docker Compose
- Node.js
- Yarn
- Turbo (globally installed):
yarn global add turbo
- All required
.env
files are checked into the repository:apps/backend/.env
apps/backend/.env.test
apps/frontend/.env
This will start the database, backend, and frontend services:
docker-compose up -d
Run migrations inside the backend container to set up the database schema:
docker-compose exec backend yarn prisma migrate dev --name init
After running migrations, generate the Prisma client:
docker-compose exec backend yarn prisma generate
To seed the main database manually, run:
docker-compose exec backend yarn workspace backend prisma db seed
To reset the main database (drops all data, reapplies all migrations, and runs the seed script):
docker-compose exec backend yarn prisma migrate reset --force --skip-seed
docker-compose exec db psql -U postgres -c "DROP DATABASE IF EXISTS db_test;"
docker-compose exec db psql -U postgres -c "CREATE DATABASE db_test;"
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001
You can connect to the PostgreSQL database using the following credentials:
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/db?schema=public"
To run linting, type checking, and unit tests for all packages in one command:
turbo check
Note that this does not execute E2E tests.
To run linting, type checking, and tests for all packages in one command:
turbo lint
To run unit tests for the backend and frontend, use:
turbo test
To run Playwright end-to-end tests using Docker Compose (recommended):
docker-compose run --rm playwright
This will:
- Start the Playwright container with all dependencies and browsers
- Use Docker's internal networking to access your frontend and backend services