Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
92b2acb
feat: Add complete Form Builder application with React frontend, Lara…
NwaforChukwuebuka Oct 26, 2025
c5b5d2e
chore: Add Railway deployment configuration and documentation
NwaforChukwuebuka Oct 26, 2025
32915aa
fix: Update Railway start command to change directory to backend
NwaforChukwuebuka Oct 26, 2025
1065c3b
fix: Switch Railway to use Dockerfile instead of Nixpacks for more co…
NwaforChukwuebuka Oct 26, 2025
4d2a4ad
fix: Update dockerfilePath to backend/Dockerfile
NwaforChukwuebuka Oct 26, 2025
6fe2817
fix: Set dockerfilePath to Dockerfile (service root is backend/)
NwaforChukwuebuka Oct 26, 2025
fa31297
fix: Remove root railway.json that conflicts with backend service
NwaforChukwuebuka Oct 26, 2025
a9f1c51
fix: Simplify railway.json, let Railway auto-detect Dockerfile
NwaforChukwuebuka Oct 26, 2025
2468170
Fix Railway build: Remove invalid composer.lock from Dockerfile
NwaforChukwuebuka Oct 26, 2025
2525998
Dockerfile: create storage and bootstrap/cache before chmod to fix Ra…
NwaforChukwuebuka Oct 26, 2025
0e5e314
Add missing Laravel artisan entry script for backend
NwaforChukwuebuka Oct 26, 2025
7c1eb67
Fix: Add missing bootstrap/app.php for Laravel artisan command
NwaforChukwuebuka Oct 26, 2025
2101d9d
Fix Laravel Railway deployment - Add missing core bootstrap files
NwaforChukwuebuka Oct 26, 2025
49dceb6
Fix composer.lock corruption - Update Dockerfile build process
NwaforChukwuebuka Oct 26, 2025
fcdc20e
Fix Class 'Facade' not found error in app.php
NwaforChukwuebuka Oct 26, 2025
7138ce4
Fix frontend Railway deployment - Update nginx to use dynamic PORT
NwaforChukwuebuka Oct 26, 2025
e5ef963
Add deployment success documentation
NwaforChukwuebuka Oct 26, 2025
ebf05eb
Fix frontend nginx startup - use PORT 8080
NwaforChukwuebuka Oct 26, 2025
80408bd
Fix nginx port substitution - use __PORT__ placeholder
NwaforChukwuebuka Oct 26, 2025
1a8bf34
Fix nginx sed command - replace 80 with PORT variable
NwaforChukwuebuka Oct 26, 2025
89a0afc
Fix PORT substitution with envsubst and sed
NwaforChukwuebuka Oct 26, 2025
9de2e09
Simplify nginx port replacement - use simple sed
NwaforChukwuebuka Oct 26, 2025
62c448d
Hardcode nginx to listen on port 8080 - no dynamic replacement needed
NwaforChukwuebuka Oct 26, 2025
868bbdd
Trigger Railway rebuild to pick up VITE_API_BASE_URL
NwaforChukwuebuka Oct 26, 2025
a0c50c3
Hardcode VITE_API_BASE_URL to devops-backend for production
NwaforChukwuebuka Oct 26, 2025
bcfe047
Add automatic database migrations on deploy
NwaforChukwuebuka Oct 27, 2025
1276ef7
Update README with Railway deployment URLs and configuration
NwaforChukwuebuka Oct 27, 2025
29366d2
Add detailed logging to exception handler for debugging
NwaforChukwuebuka Oct 27, 2025
bbf87f7
Add database connection test endpoint
NwaforChukwuebuka Oct 27, 2025
225d691
Fix storage directory permissions and add Railway troubleshooting docs
NwaforChukwuebuka Oct 27, 2025
92db739
Fix storage directory permissions in Railway deployment
NwaforChukwuebuka Oct 27, 2025
d666717
Merge branch 'feature/fullstack-form-builder-deployment' of https://g…
NwaforChukwuebuka Oct 27, 2025
584c328
Remove sensitive documentation files with credentials from repository
NwaforChukwuebuka Oct 27, 2025
90e0322
Fix Laravel ViewServiceProvider error: Add missing view config and ex…
NwaforChukwuebuka Oct 27, 2025
5b24c83
Fix 500 error on /api/register: Add users table migration and remove …
NwaforChukwuebuka Oct 27, 2025
4b79a98
Fix migrations not running on Railway: Run migrations at runtime inst…
NwaforChukwuebuka Oct 27, 2025
5b81d23
Fix crash loop: Make migrations idempotent and handle errors gracefully
NwaforChukwuebuka Oct 27, 2025
01074e5
Enable detailed error responses for API endpoints for debugging
NwaforChukwuebuka Oct 27, 2025
6fbd426
Fix register endpoint: Remove password_confirmation from API request
NwaforChukwuebuka Oct 27, 2025
647554f
Add missing base Controller class
NwaforChukwuebuka Oct 27, 2025
d8b0a23
Refactor forms list UI to match design specifications
NwaforChukwuebuka Oct 27, 2025
3ed2d6b
Refactor form builder with inline editing and enhanced UX
NwaforChukwuebuka Oct 28, 2025
901fcfc
UI improvements: visible form title border and enhanced empty state
NwaforChukwuebuka Oct 28, 2025
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
22 changes: 22 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Docker Environment
.env

# Backend specific
/backend/vendor/
/backend/.env
/backend/storage/logs/*
/backend/storage/framework/cache/*
/backend/storage/framework/sessions/*
/backend/storage/framework/views/*

# Frontend specific
/frontend/node_modules/
/frontend/dist/
/frontend/.env.local

# Build artifacts
*.log
*.pid
*.seed
*.pid.lock

113 changes: 113 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Build and Deploy

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build-frontend:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json

- name: Install dependencies
run: |
cd frontend
npm install --legacy-peer-deps

- name: Build frontend
run: |
cd frontend
npm run build

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: frontend-dist
path: frontend/dist

build-backend:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, pdo, pdo_mysql, xml, gd, zip

- name: Copy .env
run: |
cd backend
cp .env.example .env

- name: Install dependencies
run: |
cd backend
composer install --no-interaction --prefer-dist --optimize-autoloader

- name: Generate app key
run: |
cd backend
php artisan key:generate --ansi
continue-on-error: true

- name: Test backend
run: |
cd backend
php artisan config:cache
continue-on-error: true

docker-build:
runs-on: ubuntu-latest
needs: [build-frontend, build-backend]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build Docker images
run: |
docker build -t form-builder:latest .
continue-on-error: true

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
continue-on-error: true

- name: Push Docker images
run: |
docker tag form-builder:latest ${{ secrets.DOCKER_USERNAME }}/form-builder:latest
docker push ${{ secrets.DOCKER_USERNAME }}/form-builder:latest
continue-on-error: true

deploy:
runs-on: ubuntu-latest
needs: [docker-build]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'

steps:
- name: Deploy to Railway
run: echo "Deployment would happen here"
continue-on-error: true

53 changes: 53 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Dependencies
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
.npm

# Build outputs
dist/
build/
*.local

# Environment files
.env
.env.local
.env.*.local

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# Sensitive documentation files with credentials
CONFIGURE_RAILWAY_NOW.md
COPY_THESE_TO_RAILWAY.txt
QUICK_SETUP.md
RAILWAY_BACKEND_TROUBLESHOOTING.md
RAILWAY_ENV_SETUP.md
test-backend.sh

# Temporary deployment and debugging files
DEPLOYMENT_SUCCESS.md
DEPLOYMENT_SUMMARY.md
DEPLOYMENT_FIX.md
RAILWAY_DEPLOYMENT_CHECKLIST.md
RAILWAY_FIX.md
RAILWAY_README.md
PUSH_TO_GITHUB.md
DEPLOY_TO_RAILWAY.md
HOW_TO_RUN.md
install-backend.sh
*.pdf:Zone.Identifier
error.md

# UI assets and design files
ui/
Binary file not shown.
129 changes: 128 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,128 @@
start here.
# Form Builder Application - Full-Stack & DevOps Assessment

## Overview

A complete Dynamic Form Builder application with React frontend, Laravel backend API, and containerized deployment setup. This application allows users to create custom forms through a drag-and-drop interface.

## Architecture

- **Frontend**: React 18 + Vite + Redux Toolkit + SASS + Ant Design + @dnd-kit
- **Backend**: Laravel 10 + Sanctum + MySQL
- **DevOps**: Docker Compose + GitHub Actions + Railway.app

## Project Structure

```
/frontend # React application with Vite
/backend # Laravel API
/docker # Docker configuration files
/.github/workflows # CI/CD pipeline
```

## Features

- **Interactive Form Builder**: Drag-and-drop interface with visual form previews
- **Inline Editing**: Click to edit field labels, options, and properties directly
- **Multiple Field Types**: Text input, radio buttons, checkboxes, file uploads, dropdowns
- **Reordering**: Drag to reorder fields within groups using intuitive drag handles
- **User Authentication**: Register, login, and manage your forms securely
- **Form Management**: Save, update, and retrieve forms via RESTful API
- **Modern UI**: Clean, responsive design with smooth animations
- **Containerized**: Docker setup for easy local development
- **CI/CD**: Automated deployment pipeline with GitHub Actions

## Quick Start with Docker

```bash
# Clone the repository
git clone <repo-url>
cd fullstack-devops-assessment

# Copy environment files
cp backend/.env.example backend/.env

# Start all services
docker-compose up -d

# Run database migrations
docker-compose exec backend php artisan migrate

# Access the application
# Frontend: http://localhost
# Backend API: http://localhost:8000/api
```

## Environment Variables

### Backend (.env)
```
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=form_builder
DB_USERNAME=root
DB_PASSWORD=password

SANCTUM_STATEFUL_DOMAINS=localhost:5173
SESSION_DOMAIN=localhost
```

### Frontend (.env)
```
VITE_API_BASE_URL=http://localhost/api
```

## API Endpoints

### Authentication
- POST /api/register - User registration
- POST /api/login - User login
- POST /api/logout - User logout
- GET /api/user - Get authenticated user

### Forms
- GET /api/forms - List user's forms
- POST /api/forms - Create form
- GET /api/forms/{id} - Get form details
- PUT /api/forms/{id} - Update form
- DELETE /api/forms/{id} - Delete form

## Live Deployment

**Frontend**: https://formx.up.railway.app/
**Backend API**: https://devops-backend.up.railway.app
**Platform**: Railway.app
**Status**: ✅ Deployed and running

### Recent Updates
- ✨ **Enhanced Form Builder**: Complete redesign with inline editing
- 🎨 **Visual Form Previews**: See exactly how fields will look
- 🔄 **Drag & Drop Reordering**: Easily rearrange fields within groups
- ✏️ **Inline Editing**: Click to edit labels and options directly
- 🎯 **Improved UX**: Single canvas interface, smooth transitions

### Railway Deployment Notes
- Frontend: React app served via nginx (https://formx.up.railway.app/)
- Backend: Laravel 10 API with MySQL database
- Database: Railway MySQL service (internal connection)
- Environment: Production

## Development

### Backend
```bash
cd backend
composer install
php artisan serve
```

### Frontend
```bash
cd frontend
npm install
npm run dev
```

## License

MIT
35 changes: 35 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/vendor/
/node_modules/
/.pnp
.pnp.js

# Laravel
/.idea
/.vscode
*.swp
*.swo
*.swn
._*

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Laravel specific
.env
.env.backup
.phpunit.result.cache
Homestead.json
npm-debug.log
yarn-error.log
/.fleet
/.idea

# Railway
.railway/

Loading