-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from timia2109/epic/users
[V2] Multiuser support
- Loading branch information
Showing
118 changed files
with
7,479 additions
and
7,531 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
# Since .env is gitignored, you can use .env.example to build a new `.env` file when you clone the repo. | ||
# Keep this file up-to-date when you add new variables to `.env`. | ||
|
||
# This file will be committed to version control, so make sure not to have any secrets in it. | ||
# If you are cloning this repo, create a copy of this file named `.env` and populate it with your secrets. | ||
|
||
# When adding additional env variables, the schema in /env/schema.mjs should be updated accordingly | ||
|
||
# Prisma | ||
DATABASE_URL=file:./db.sqlite | ||
DATABASE_URL=mysql://root:root@db/simple-meal-plan | ||
INVITATION_VALIDITY=P30D | ||
NEXTAUTH_SECRET=A_SECRET | ||
ROOT_URL=https://example.com | ||
NEXT_PUBLIC_PRIVACY_URL=https://example.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Publish Epic | ||
on: | ||
push: | ||
branches: | ||
- epic/* | ||
env: | ||
REGISTRY: ghcr.io | ||
jobs: | ||
build-docker-image: | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Docker Login | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Docker Metadata action | ||
id: docker_metadata | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ github.repository }} | ||
tags: | | ||
type=ref,event=branch | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.docker_metadata.outputs.tags }} | ||
labels: ${{ steps.docker_metadata.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,4 +40,5 @@ yarn-error.log* | |
|
||
# typescript | ||
*.tsbuildinfo | ||
.yarn/cache | ||
.yarn/cache | ||
OLD_pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Debug server-side", | ||
"type": "node-terminal", | ||
"request": "launch", | ||
"command": "pnpm dev" | ||
}, | ||
{ | ||
"name": "Debug client-side", | ||
"type": "chrome", | ||
"request": "launch", | ||
"url": "http://localhost:3000" | ||
}, | ||
{ | ||
"name": "Debug full stack", | ||
"type": "node-terminal", | ||
"request": "launch", | ||
"command": "pnpm dev", | ||
"serverReadyAction": { | ||
"pattern": "- Local:.+(https?://.+)", | ||
"uriFormat": "%s", | ||
"action": "debugWithChrome" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,27 @@ | ||
# Simple Meal Plan | ||
|
||
This is a very simple meal planner which I build in two hours. | ||
I want to replace the Excel Sheet, my girlfriend was using. | ||
Currently there a no authentication build in. So this should only deployed on private networks. | ||
Work in Progress. | ||
This is a very simple meal planner. It's main purpose is to host it as a free SaaS solution. | ||
You can use it [here](https://example.com). Anyway you can deploy it using Docker. | ||
|
||
I want to replace the Excel Sheet, my girlfriend was using. | ||
|
||
## Features | ||
|
||
![Example Screenshot](public/example.png) | ||
|
||
- Plan Meal for any date | ||
- (Tablet, Desktop): See a complete calendar of the month which is editable | ||
- Share meal plans with magic links to other users to collaborate (household, etc.) | ||
- Manage multiple meal plans per user | ||
|
||
## Techstack | ||
|
||
- [Next.js](https://nextjs.org) | ||
- [Prisma](https://prisma.io) | ||
- [Tailwind CSS](https://tailwindcss.com) | ||
- [tRPC](https://trpc.io) | ||
- [DaisyUI](https://daisyui.com) | ||
|
||
## Deployment | ||
|
||
## Screenshot | ||
![Example Screenshot](docs/example.png) | ||
You'll need a MySQL / MariaDB database. | ||
Have a look at [`.env.example`](./.env.example) or at the [schema](./src/env/schema.mjs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,45 @@ | ||
##### DEPENDENCIES | ||
FROM node:20 AS base | ||
|
||
FROM node:16-alpine AS deps | ||
RUN apk add --no-cache libc6-compat openssl1.1-compat | ||
FROM base AS builder | ||
WORKDIR /app | ||
|
||
# Install Prisma Client - remove if not using Prisma | ||
|
||
COPY prisma ./ | ||
|
||
# Install dependencies based on the preferred package manager | ||
|
||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml\* ./ | ||
|
||
RUN \ | ||
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ | ||
elif [ -f package-lock.json ]; then npm ci; \ | ||
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i; \ | ||
else echo "Lockfile not found." && exit 1; \ | ||
fi | ||
|
||
##### BUILDER | ||
|
||
FROM node:16-alpine AS builder | ||
ARG DATABASE_URL | ||
ARG NEXT_PUBLIC_CLIENTVAR | ||
WORKDIR /app | ||
COPY --from=deps /app/node_modules ./node_modules | ||
COPY . . | ||
|
||
# ENV NEXT_TELEMETRY_DISABLED 1 | ||
ENV NEXT_TELEMETRY_DISABLED=1 SKIP_ENV_VALIDATION=1 | ||
|
||
RUN \ | ||
if [ -f yarn.lock ]; then SKIP_ENV_VALIDATION=1 yarn build; \ | ||
elif [ -f package-lock.json ]; then SKIP_ENV_VALIDATION=1 npm run build; \ | ||
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && SKIP_ENV_VALIDATION=1 pnpm run build; \ | ||
else echo "Lockfile not found." && exit 1; \ | ||
fi | ||
# SET DUMMY VALUES FOR BUILD | ||
ENV DATABASE_URL=CHANGE_ME | ||
ENV GOOGLE_CLIENT_ID=CHANGE_ME | ||
ENV GOOGLE_CLIENT_SECRET=CHANGE_ME | ||
ENV NEXTAUTH_SECRET=CHANGE_ME | ||
|
||
##### RUNNER | ||
RUN corepack enable pnpm && pnpm i --frozen-lockfile && pnpm run build | ||
|
||
FROM node:16-alpine AS runner | ||
RUN apk add --no-cache libc6-compat openssl1.1-compat | ||
# ================================# | ||
# PROD | ||
# ================================ | ||
FROM base AS runner | ||
WORKDIR /app | ||
|
||
ENV NODE_ENV production | ||
|
||
# ENV NEXT_TELEMETRY_DISABLED 1 | ||
ENV NODE_ENV=production NEXT_TELEMETRY_DISABLED=1 | ||
|
||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
|
||
COPY --from=builder /app/next.config.mjs ./ | ||
COPY --from=builder /app/public ./public | ||
COPY --from=builder /app/package.json ./package.json | ||
COPY --from=builder --chown=nextjs:nodejs /app/public ./public | ||
COPY --chown=nextjs:nodejs prisma ./prisma/ | ||
|
||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | ||
# Set the correct permission for prerender cache | ||
RUN mkdir .next | ||
RUN chown nextjs:nodejs .next | ||
RUN npm install prisma | ||
|
||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static | ||
COPY --chown=nextjs:nodejs ./init.sh . | ||
|
||
USER nextjs | ||
|
||
EXPOSE 3000 | ||
ENV PORT 3000 | ||
|
||
CMD ["node", "server.js"] | ||
ENV PORT=3000 HOSTNAME=0.0.0.0 | ||
ENTRYPOINT [ "/bin/sh", "./init.sh" ] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
#!/bin/sh | ||
npx prisma migrate deploy | ||
node server.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.