Skip to content

nikolaitandberg/hjemmeside

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

131 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hjemmeside

Personal e-portfolio with an admin panel. Next.js + SQLite (via Prisma), deployed with Docker.

Local dev

npm install

# First run only — create the SQLite DB and tables
npx prisma migrate dev

# Create admin user
ADMIN_EMAIL=you@example.com ADMIN_PASSWORD=yourpassword node scripts/create-admin.mjs

npm run dev   # → http://localhost:3000

.env (gitignored, already present locally):

DATABASE_URL="file:./data/hjemmeside-dev.db"
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=<secret>

Prisma Studio: npx prisma studiohttp://localhost:5555

Schema: prisma/schema.prisma


Docker dev

Builds the production image with source bind-mounted, plus Prisma Studio as a sidecar.

docker compose -f docker-compose.dev.yml up --build

See docker-compose.dev.yml.


Production

Deployed via GitHub Actions (.github/workflows/deploy.yml) — trigger manually from the Actions tab.

The workflow SSHs into the server and runs:

git reset --hard origin/main → docker compose up --build -d

prisma migrate deploy runs automatically inside the container before the app starts (see CMD in Dockerfile), so no separate migration step is needed after deploy.

Before the first deploy, create .env on the server:

DATABASE_URL="file:/app/data/hjemmeside.db"
NEXTAUTH_URL=https://yourdomain.com
NEXTAUTH_SECRET=<secret>   # openssl rand -base64 32

After the first deploy, create the admin user:

docker compose exec -e ADMIN_EMAIL=you@example.com -e ADMIN_PASSWORD=yourpassword hjemmeside node scripts/create-admin.mjs

SQLite data persists in a named Docker volume (sqlite_data). See docker-compose.yml and Dockerfile.

Image size note: the Docker image intentionally copies the full node_modules (not just the Next.js standalone subset). This is required because the Prisma 6.x CLI has a deep transitive dependency tree absent from the standalone output, and cherry-picking packages breaks on every Prisma upgrade. The image is larger (~400 MB extra) but maintenance-free.


Schema changes

npx prisma migrate dev --name describe_change

License

MIT

About

Simple e-portfolio, with custom cms and admin page. Deployed on old office computer running in the livingroom of my flatshare.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors