This repository contains a full-stack application with a SvelteKit client and a Spring Boot server. It demonstrates modern web application architecture and DevOps practices.
This project includes:
- Client: SvelteKit with TypeScript, TailwindCSS, and reusable UI components.
- Server: Spring Boot Java application with RESTful APIs.
- DevOps: Dockerized services, CI/CD pipelines, and production-ready deployment configurations.
- Node.js (v22 or later)
- Java JDK 21+
- Gradle
- Docker and Docker Compose
- Docker Desktop with Kubernetes
- Git
git clone https://github.com/yourusername/w04-template.git
cd w04-template
- Navigate to the
client
directory:cd client
- Install dependencies:
npm install
- Navigate to the
server
directory:cd server
- Build the project:
./gradlew build
cd client
npm run dev
The client will be available at http://localhost:3000.
cd server
./gradlew bootRun
The server API will be available at http://localhost:8080.
- Built with SvelteKit and TypeScript for a modern, reactive UI.
- TailwindCSS for styling.
- Components and routes are organized in the
src
directory.
- Built with Spring Boot for scalable and maintainable server services.
- Gradle is used for dependency management and building.
- Source code is in the
src/main/java
directory. - Tests are in the
src/test/java
directory.
cd client
npm run build
cd server
./gradlew clean build
The project includes Docker configurations for containerized deployment.
- Build and start the services:
docker compose up --build
- Access the application:
- Client: http://localhost:3000
- Server: http://localhost:8080
This project can be deployed to a Kubernetes cluster. The Kubernetes configuration files are located in the k8s
directory.
Before deploying, make sure you're using Docker Desktop's Kubernetes:
-
Verify that Kubernetes is enabled in Docker Desktop:
- Open Docker Desktop
- Go to Settings/Preferences
- Select "Kubernetes" from the left menu
- Check "Enable Kubernetes"
- Click "Apply & Restart" if needed
-
Confirm Docker Desktop is your current kubectl context:
kubectl config current-context
This should return
docker-desktop
or similar. -
If needed, switch to Docker Desktop context:
kubectl config use-context docker-desktop
Follow these steps to deploy the application correctly:
-
Create the namespace and deploy all resources at once:
kubectl apply -f k8s/namespace.yaml kubectl apply -f k8s
-
Check the status of all deployed resources:
kubectl -n canteen-app get all
-
Verify services are running with the correct ports:
kubectl -n canteen-app get service
You should see the client service using NodePort 30000 and the server service using NodePort 30001.
-
Wait for all pods to be in the running state:
kubectl -n canteen-app get pods
After successful deployment, you can access:
- The client application at: http://localhost:30000
- The server API directly at: http://localhost:30001
The client is already configured to communicate with the server through the fixed NodePort 30001 as defined in the ConfigMap.
The project includes GitHub Actions workflows for:
- Building Docker Images: Automatically builds and pushes Docker images to GitHub Container Registry.
- Deploying Docker Images: Deploys the application to a production environment using Docker Compose.
├── client/ # SvelteKit client
│ ├── src/ # Source code
│ ├── public/ # Static assets
│ └── package.json # Client dependencies
│
├── server/ # Spring Boot server
│ ├── src/ # Source code
│ ├── build.gradle # Gradle build file
│ └── Dockerfile # Server Dockerfile
│
├── k8s/ # Kubernetes configuration files
│ ├── client-deployment.yaml
│ ├── client-service.yaml
│ ├── server-deployment.yaml
│ ├── server-service.yaml
│ ├── configmap.yaml
│ └── namespace.yaml
│
├── compose.yml # Docker Compose for local development
└── .github/workflows/ # CI/CD workflows
This project is licensed under the MIT License.