Pixel to Pattern turns your pixel art into beautiful, beginner-friendly crochet patterns, stitch by stitch and row by row.
Let the creativity flow.
Turn any pixel drawing into a crochet-ready pattern.
Each row lists the stitch counts per color, for example:
(sc = single crochet)
Row 1: 28 sc (white)
Row 2: 9 sc (white), 10 sc (yellow), 9 sc (white)
Row 3: 8 sc (white), 10 sc (yellow), 9 sc (white)
Browse all submitted creations and view detailed, stitch-by-stitch patterns.
Users will soon be able to edit their own patterns directly.
Remove any pattern you’ve posted with one click.
- Frontend: Next.js, Material UI, React
- Backend: Node.js, Express
- Database: MySQL with Sequelize ORM
- Deployment: Docker containers, GitHub Container Repository (GHCR)
- Version: Node 24+
This project utilizes environment variables for configuration.
You will need to create both a .env file in the root directory and a .env.local file in the client directory, as outlined below.
Required Variables:
DB_USER: The username for the database user.DB_PASSWORD: The password for the database user.DB_HOST: The IP address for the machine running the database (uselocalhostfor local development ordbfor Docker).DB_DATABASE: The name of the database to access.DB_PORT: The port number the database is running on.SERVER_PORT: The port number for the backend server (default: 3000).
Note: The frontend uses relative URLs with Next.js rewrites to communicate with the backend. No environment variables are required for the client in Docker setups.
You can run the entire Pixel to Pattern stack locally using Docker Compose.
- Fork and clone this repository:
git clone https://github.com/AlexanderORuban/Pixel-to-Pattern.git
- Ensure Docker and Docker Compose are installed.
- Create a
.envfile in the root directory with the necessary credentials listed above. - Build and start all services:
docker compose up --build
- Visit http://localhost:3001 to access the application.
To stop containers:
docker compose downIf you make code changes and want to rebuild the images:
docker compose build --no-cache
docker compose up -dTo restart containers without rebuilding:
docker compose restartThese steps apply only if you wish to run Pixel to Pattern manually without Docker.
- Fork and clone this repository:
git clone https://github.com/AlexanderORuban/Pixel-to-Pattern.git
- In the root directory, create a
.envfile as described above. - Install dependencies in the root,
server/, andclient/directories:npm install
- Run the application from the root:
npm run dev
- Open your browser at http://localhost:3001
- Start creating your pattern.
-
Create GHCR containers for both frontend and backend.
-
Log into GHCR in your terminal or code editor:
echo "<YOUR_GITHUB_TOKEN>" | docker login ghcr.io -u <your_github_username> --password-stdin
-
Build and push the backend container:
docker build --no-cache -t ghcr.io/<UserName>/pixel-to-pattern-backend:latest ./server docker push ghcr.io/<UserName>/pixel-to-pattern-backend:latest
-
Build and push the frontend container:
docker build --no-cache -t ghcr.io/<Username>/pixel-to-pattern-frontend ./client docker push ghcr.io/<UserName>/pixel-to-pattern-frontend:latest
- Log into your VM:
ssh root@<VM_IP>
- Update the package index:
sudo apt-get update -y
- Upgrade existing packages (non-interactive):
yes | sudo DEBIAN_FRONTEND=noninteractive apt-get -yqq upgrade - Install Docker dependencies:
sudo apt install -y ca-certificates curl gnupg lsb-release
- Add the Docker GPG key and repository:
sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- Install the Docker engine and compose plugin:
sudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- Verify installation:
Expected output: “Hello from Docker!”
sudo docker run hello-world
- Create a new project directory:
mkdir <project_name> && cd <project_name>
- Add your
docker-compose.deploy.ymlfile to the directory. - Create a
.envfile and place it at the same level as the YAML file. - Pull the images:
docker compose -f docker-compose.deploy.yml pull
- Start the application:
docker compose -f docker-compose.deploy.yml up -d
- Verify the containers are running:
docker ps
Common Docker Issues
-
Ports already in use:
Stop conflicting containers or change the port indocker-compose.yml.docker ps docker stop <container_id>
-
Environment variables not loading:
Ensure the.envfile is in the root directory and not ignored by.dockerignore. -
Containers not starting:
Check logs for detailed errors:docker compose logs
-
MySQL connection errors:
UseDB_HOST=dbin your.envwhen using Docker Compose.
Test with:docker exec -it db mysql -u root -p
- (If needed) force Docker to build/rebuild clean docker-compose.test image:
docker compose -f docker-compose.test.yml build --no-cache
- Spin up Docker test services:
docker compose -f docker-compose.test.yml up
- Close Docker test services:
docker compose -f docker-compose.test.yml down -v
From the server directory, run npm run test:unit to run Jest unit tests locally.
- From the root, run
docker compose -f docker-compose.test.yml up backend-unit-tests --abort-on-container-exit --exit-code-from backend-unit-tests - Clean up:
docker compose -f docker-compose.test.yml down -v
From the client directory, run npm test to run Jest unit tests locally.
- From the root, run
docker compose -f docker-compose.test.yml up frontend-tests --abort-on-container-exit --exit-code-from frontend-tests - Clean up:
docker compose -f docker-compose.test.yml down -v
Only run the integration tests in the docker compose test.
- From the root, run
docker compose -f docker-compose.test.yml up db-test backend-integration --abort-on-container-exit --exit-code-from backend-integration - Clean up:
docker compose -f docker-compose.test.yml down -v
- Run from the root of the project
- The app needs to be running in docker locally before testing
- Remember to run
npm ifirst
npm run cypress:runnpm run cypress:open