Skip to content
Open
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
Binary file added .DS_Store
Binary file not shown.
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DB_ROOT_PASSWORD=root
DB_DATABASE=app_db
DB_USERNAME=app
DB_PASSWORD=password
DB_PORT=3306
APP_ENV=local
APP_DEBUG=true
NODE_ENV=development
REACT_APP_API_URL=http://localhost:80/api
Empty file added .github/workflows/deploy.yml
Empty file.
81 changes: 80 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,80 @@
start here.

# Dynamic Form Builder Application
## Live Demo
**URL**: [\[Your deployed application URL\]](https://fullstack-devops-assessment-preshy1.vercel.app/login)
**Test Credentials** (optional):
- Email:
- Password:



## Quick Start with Docker
1. Initial Build: Build the images and start the services in detached mode.
docker compose up --build -d

2. Access: The application will be accessible at http://localhost.
Execute the artisan command inside the running 'backend' container
docker compose exec backend php artisan migrate

## API Documentation
Authentication Endpoints

All authenticated routes require a valid JWT token passed in the Authorization: Bearer <token> header.



POST /api/register

POST /api/login (User login (returns JWT)) Public

POST /api/logout Auth

GET /api/user



Form Management Endpoints

These endpoints are protected by the auth:api middleware.

GET /api/forms

POST /api/forms


GET /api/forms/{id}

PUT /api/forms/{id}

DELETE /api/forms/{id}

## Frontend Features

### Form Builder
- ✅ **Drag & Drop Interface** - Intuitive field placement
- ✅ **Sections & Groups** - Organize forms hierarchically
- ✅ **Multiple Field Types** - Text, radio, checkbox, file upload, dropdown, date picker
- ✅ **Field Configuration** - Required fields, full-width layout, labels, placeholders
- ✅ **Undo/Redo** - Full history management
- ✅ **Real-time Preview** - See form as you build

### Field Types Supported

**Standard Fields:**
- Photo Upload
- Text Inputs (Name, Email, Mobile)
- Date Picker
- Radio Buttons
- Checkboxes
- Dropdowns

## Technical Decisions
[Your approach and reasoning]
## Deployment
**Platform**: [Vercel]
**Why this platform**: [Brief explanation]
**Deployment steps**: [How you deployed]
## Environment Variables
[Required configuration]
## Known Limitations
[What's not included and why]
18 changes: 18 additions & 0 deletions backend/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[compose.yaml]
indent_size = 4
65 changes: 65 additions & 0 deletions backend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US

APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database

PHP_CLI_SERVER_WORKERS=4

BCRYPT_ROUNDS=12

LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=app_db
DB_USERNAME=app
DB_PASSWORD=password

SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

CACHE_STORE=database
# CACHE_PREFIX=

MEMCACHED_HOST=127.0.0.1

REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

VITE_APP_NAME="${APP_NAME}"
11 changes: 11 additions & 0 deletions backend/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* text=auto eol=lf

*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
24 changes: 24 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
*.log
.DS_Store
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
/.fleet
/.idea
/.nova
/.phpunit.cache
/.vscode
/.zed
/auth.json
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/storage/pail
/vendor
Homestead.json
Homestead.yaml
Thumbs.db
40 changes: 40 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

FROM php:8.1-cli

# Install system dependencies required for composer and common php extensions
RUN apt-get update && apt-get install -y \
git \
unzip \
libzip-dev \
libpng-dev \
libonig-dev \
libxml2-dev \
curl \
zip \
&& docker-php-ext-install pdo_mysql mbstring zip exif pcntl bcmath

# Install Composer
COPY --from=composer:2.6 /usr/bin/composer /usr/bin/composer

WORKDIR /var/www/html

# Copy composer files for dependency install first (cache)
COPY composer.json composer.lock /var/www/html/
RUN composer install --no-dev --optimize-autoloader --no-interaction

# Copy the rest of application
COPY . /var/www/html

# Ensure storage and bootstrap cache are writable
RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache || true
RUN chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache || true

# Copy entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh

EXPOSE 8000

# Use entrypoint to run migrations (configurable) and start server
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]
133 changes: 133 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
Form Management RESTful API

This API provides user authentication and complete CRUD operations for managing user-defined forms.

Technical Stack

Framework: Laravel 10+

Authentication: JWT (via tymon/jwt-auth)

Database: MySQL/PostgreSQL

API Response Format

All successful responses adhere to the following JSON structure:

{
"success": true,
"data": {
// resource or collection data
},
"message": "A descriptive message"
}



Error responses use a 4xx or 5xx HTTP status code and the following structure:

{
"success": false,
"message": "Error description",
"errors": {
// Optional: detailed validation errors
}
}



Authentication Endpoints

All authenticated routes require a valid JWT token passed in the Authorization: Bearer <token> header.

Method

Endpoint

Description

Guard

POST

/api/register

User registration

Public

POST

/api/login

User login (returns JWT)

Public

POST

/api/logout

Invalidates the current JWT

Auth

GET

/api/user

Get authenticated user details

Auth

Form Management Endpoints

These endpoints are protected by the auth:api middleware.

Method

Endpoint

Description

Guard

GET

/api/forms

List all forms for the authenticated user

Auth

POST

/api/forms

Create a new form with structure

Auth

GET

/api/forms/{id}

Get specific form details

Auth

PUT

/api/forms/{id}

Update form metadata or structure

Auth

DELETE

/api/forms/{id}

Delete a form

Auth
Loading