- Claire
- Jenny
- Julia
- Laurie
A modern full-stack web application template featuring Spring Boot backend and Next.js frontend with Docker-based development environment.
Zero-install development setup - Get started instantly with Docker containers for all services and dependencies. No need to install Java, Gradle, or databases locally.
- Features
- Prerequisites
- Initial Setup
- Quick Start
- Development Commands
- Project Structure
- API Integration
- Development Notes
- CI/CD Pipeline
- Deployment
- Troubleshooting
- Full-Stack Integration - Spring Boot 3.5.6 backend with Next.js 15.5.4 frontend
- Containerized Development - Backend runs in Docker, frontend runs locally for optimal development experience
- Instant Setup - No local Java/Gradle installation required for backend
- Live Reload - Automatic code changes with Spring Boot DevTools and Next.js hot reload
- Complete Stack - PostgreSQL database, Redis cache, and Mailpit email testing
- API Integration - Seamless communication between frontend and backend with CORS configuration
- Type Safety - TypeScript interfaces for API responses and centralized API client
- CI/CD Ready - GitHub Actions workflows for linting, building, and testing
- Simple Commands - Easy-to-use
sailCLI for all development tasks
- Docker Desktop (macOS/Windows) or Docker Engine (Linux)
- Node.js 22.20.0 (see
.nvmrcfile for exact version) - Terminal access for running commands
- (Windows users) Git Bash or WSL recommended for best experience
Note: No Java or Gradle installation needed - backend runs in Docker containers.
π« School Network Users - Important Note
If you're on a school network with security restrictions, you may need to:
- Use a specific NVM mirror for Node.js installation
- Temporarily disable SSL verification for npm installs
See the Initial Setup section for detailed instructions.
Docker Desktop
- Download from: https://www.docker.com/products/docker-desktop/
- Install and start Docker Desktop (takes a moment to boot)
Visual Studio Code
- Download from: https://code.visualstudio.com/download
- Install and verify it works
Git
-
Windows users: Download from https://gitforwindows.org/ (includes Git Bash)
-
Mac users: Install Xcode Command Line Tools:
xcode-select --installπ Mac Users - Xcode Command Line Tools
If you don't have Git installed on Mac, run this command in Terminal:
xcode-select --install
This will install Git and other essential development tools. You may be prompted to install additional software - click "Install" when prompted.
- Open the repository: https://github.com/HolyNamesAcademy/Projects-II-25-26/
- Click the green "Code" button and copy the repository URL
- Open VSCode and click "Clone Repository"
- Paste the repository URL and clone
- Open the project in VSCode
πͺ Windows Users - Line Endings Fix
To ensure all files use Linux (LF) line endings (required for Docker and shell scripts), run this command in Git Bash:
find . -type f -not -path '*/\.git/*' -exec dos2unix {} +; git checkout .This converts Windows (CRLF) line endings to Unix (LF) format, which is required for proper Docker container execution.
Install NVM:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bashConfigure NVM:
- Windows (Git Bash):
nano ~/.bash_profile - Mac:
nano ~/.zshrc
Add this content:
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvmSave with: Ctrl+X, then Y, then Enter
Open a new terminal (Git Bash on Windows)
π« School Network (with security restrictions)
NVM_NODEJS_ORG_MIRROR=http://nodejs.org/dist nvm installπ Home Network
nvm installπ« School Network (with security restrictions)
cd frontend
# Disable SSL verification temporarily for school network
npm config set strict-ssl false
npm install
# Re-enable SSL verification for security
npm config set strict-ssl trueπ Home Network
cd frontend
npm installAfter completing all setup steps, verify everything is working:
# Check if Docker is running
docker --version
# Check if Node.js is installed
node --version # Should show v22.20.0
# Check if Git is working
git --version
# Test the sail script
./sail --versionIf any of these commands fail, go back to the relevant setup step above.
First time? Make sure you've completed the Initial Setup steps above.
-
Start the development environment:
./sail up
-
Run the backend:
./sail backend
-
Run the frontend (in a new terminal):
./sail frontend
-
Verify everything is working:
- Open http://localhost:3000 - you should see the frontend
- Open http://localhost:8080/api/health - you should see
{"status":"UP"}
| Service | URL | Description |
|---|---|---|
| Frontend | http://localhost:3000 | Main application interface |
| Backend API | http://localhost:8080/api | REST API endpoints |
| Mailpit UI | http://localhost:8025 | Email testing interface (SMTP: 1025) |
| PostgreSQL | localhost:5432 | Database (user: app, pass: app, db: app) |
| Redis | localhost:6379 | Cache and session storage |
./sail up Start dev environment (services only)
./sail down Stop everything
./sail restart Restart all containers
./sail run Run the backend (hot reload via devtools)
./sail backend Run the backend (alias for run)
./sail debug Run the backend with debug port 5005 enabled
./sail test Run backend tests in the container
./sail clean Clean build artifacts in the container
./sail backend:lint Run backend checkstyle and SpotBugs linting
./sail frontend Run the frontend dev server
./sail frontend:dev Run the frontend dev server (alias)
./sail frontend:build Build the frontend for production
./sail frontend:start Start the frontend production server
./sail frontend:lint Run frontend linting
./sail build Rebuild the app image
./sail sh Shell into the app container (bash)
./sail logs Tail all container logs
./sail ps Show container status
./sail status Check Docker daemon and container status
./sail psql Open psql in the Postgres container
./sail redis-cli Open redis-cli in the Redis container
# Start your day
./sail up # Start all services
./sail backend # Run backend (Terminal 1)
./sail frontend # Run frontend (Terminal 2)# Backend changes - automatic restart via DevTools
# Frontend changes - automatic hot reload
# Test your changes
./sail test # Run backend tests
./sail frontend:lint # Check frontend code quality./sail ps # Check what's running
./sail logs # View all logs
./sail status # Check Docker status./sail down # Stop all containersβββ backend/ # Spring Boot backend
β βββ src/main/java/ # Java source code
β β βββ com/hna/webserver/
β β βββ config/ # CORS configuration
β β βββ controller/ # REST controllers
β βββ src/main/resources/ # Application configuration
β β βββ application.properties
β β βββ application-dev.yml # Docker dev profile
β βββ build.gradle # Gradle build configuration
β βββ config/checkstyle/ # Code quality configuration
βββ frontend/ # Next.js frontend
β βββ src/app/ # App router pages
β β βββ page.tsx # Home page
β βββ src/lib/ # API utilities
β β βββ api.ts # Centralized API client
β βββ package.json # Frontend dependencies
β βββ next.config.ts # Next.js configuration
β βββ tsconfig.json # TypeScript configuration
βββ .github/workflows/ # GitHub Actions CI/CD workflows
β βββ ci.yml # Main CI pipeline
β βββ backend-*.yml # Backend-specific workflows
β βββ frontend-*.yml # Frontend-specific workflows
βββ docker-compose.yml # Docker services configuration
βββ Dockerfile.dev # App container image
βββ .nvmrc # Node.js version specification
βββ sail # Command helper script
βββ README.md # This file
import { api } from '@/lib/api';
// Example usage
const data = await api.hello();- Hot reload: Spring Boot DevTools for backend, Next.js hot reload for frontend
- CORS: Configured to allow frontend requests from localhost:3000
- API Proxying: Next.js automatically proxies
/api/*to backend - Type Safety: TypeScript interfaces for all API responses
- Profiles: Backend runs with
SPRING_PROFILES_ACTIVE=devin Docker - Database: PostgreSQL configured for development
- Caching: Redis available for caching
- Email: Mailpit for email testing
- Start services:
./sail up(starts Docker containers) - Run backend:
./sail backend(in one terminal) - Run frontend:
./sail frontend(in another terminal) - Make changes: Edit code in your IDE
- See changes: Frontend updates automatically, backend restarts automatically
- Test API: Use
curl http://localhost:8080/api/healthor test endpoints directly
The .github/workflows/ folder contains GitHub Actions workflows that automatically run on every push and pull request, handling linting, building, and testing for both frontend and backend.
This template is ready for deployment to any cloud provider that supports Spring Boot and Next.js applications. Update the environment variables in your deployment platform to point to your production services.
π CORS Errors
- Ensure backend is running on port 8080
- Check CORS configuration in
backend/src/main/java/com/hna/webserver/config/CorsConfig.java - Verify frontend is running on localhost:3000
π API Connection Failed
- Verify backend is running:
./sail ps - Check backend logs:
./sail logs - Ensure services are up:
./sail up
βοΈ Frontend Not Loading
- Ensure Node.js version matches
.nvmrc(22.20.0) - Install dependencies:
cd frontend && npm install - Check if port 3000 is available
ποΈ Database Connection Issues
- Ensure PostgreSQL is running:
./sail ps - Check database logs:
./sail logs db - Verify connection settings in
application-dev.yml
π³ Docker Issues
- Check Docker daemon is running:
./sail status - Restart Docker Desktop if needed
- Clean up containers:
./sail down && docker system prune - Rebuild containers:
./sail build
π Port Conflicts
- Ensure ports 3000, 8080, 5432, 6379, and 8025 are available
- Check what's using a port:
lsof -i :PORT_NUMBER(macOS/Linux) - Kill process using port:
kill -9 PID(replace PID with actual process ID)
πͺ Windows Terminal Issues
- Always use Git Bash instead of PowerShell for running
./sailcommands - In VSCode, click the arrow next to the
+button in terminal and select "Git Bash" - If commands don't work, ensure you're in the project root directory
# Check service status
./sail ps
# View all logs
./sail logs
# Check Docker status
./sail status
# Shell into backend container
./sail sh
# Test API endpoints directly
curl http://localhost:8080/api/healthIf you're still having issues:
- Check the logs:
./sail logs- look for error messages - Restart everything:
./sail restart - Verify your setup: Make sure you completed all Initial Setup steps
- Check your environment: Ensure Docker is running and ports are available
- Ask for help: Contact your instructor or team members
Run this command to verify everything is working:
# Check all services
./sail ps
# Test API connectivity
curl http://localhost:8080/api/health
# Check frontend
open http://localhost:3000