-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* deleted v1 desktop + api v1 * api v2 + integrated google auth + toasters * added tests + logout implementation * fix for build * add infisical + some contributions stuff * add ci * implemented create task and list tasks in api + app * implemented update task * implemented delete task * implemented toggle complete task * use pnpm in ci * correctly use pnpm in ci * install types for passport * some fixes + create task placeholder for ease of use * added dockerfile * added railway.toml + some logging * remove tests in CI for now
- Loading branch information
Showing
281 changed files
with
6,156 additions
and
12,990 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
**/node_modules | ||
node_modules/ | ||
fly.toml | ||
Dockerfile | ||
.dockerignore | ||
.git | ||
out |
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,46 @@ | ||
name: CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
migrate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18 | ||
|
||
- uses: pnpm/action-setup@v2 | ||
name: Install pnpm | ||
with: | ||
version: 7 | ||
run_install: false | ||
|
||
- name: Get pnpm store directory | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- uses: actions/cache@v3 | ||
name: Setup pnpm cache | ||
with: | ||
path: ${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Run migrations to prod DB | ||
run: pnpm db:migrate | ||
env: | ||
DATABASE_URL: ${{ secrets.DATABASE_URL }} | ||
|
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,50 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18 | ||
|
||
- uses: pnpm/action-setup@v2 | ||
name: Install pnpm | ||
with: | ||
version: 7 | ||
run_install: false | ||
|
||
- name: Get pnpm store directory | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- uses: actions/cache@v3 | ||
name: Setup pnpm cache | ||
with: | ||
path: ${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Lint code | ||
run: pnpm lint | ||
|
||
- name: Build | ||
run: pnpm build |
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,5 @@ | ||
{ | ||
"workspaceId": "65009d2c9296eef8d1b241a6", | ||
"defaultEnvironment": "", | ||
"gitBranchToEnvironmentMapping": null | ||
} |
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,5 @@ | ||
**/node_modules | ||
fly.toml | ||
Dockerfile | ||
.dockerignore | ||
.git |
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 @@ | ||
node_modules | ||
# Keep environment variables out of version control | ||
.env | ||
dist/ |
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,60 @@ | ||
FROM node:18-alpine AS base | ||
|
||
RUN corepack enable && corepack prepare pnpm@latest --activate | ||
# Enable `pnpm add --global` on Alpine Linux by setting | ||
# home location environment variable to a location already in $PATH | ||
# https://github.com/pnpm/pnpm/issues/784#issuecomment-1518582235 | ||
ENV PNPM_HOME=/usr/local/bin | ||
ENV PATH="${PATH}:${PNPM_HOME}" | ||
RUN pnpm add --global turbo | ||
|
||
# The web Dockerfile is copy-pasted into our main docs at /docs/handbook/deploying-with-docker. | ||
# Make sure you update this Dockerfile, the Dockerfile in the web workspace and copy that over to Dockerfile in the docs. | ||
|
||
FROM base AS builder | ||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. | ||
RUN apk add --no-cache libc6-compat | ||
RUN apk update | ||
# Set working directory | ||
WORKDIR /app | ||
COPY . . | ||
RUN turbo prune --scope=api-v2 --docker | ||
# remove all empty node_modules folder structure | ||
RUN rm -rf /app/out/full/*/*/node_modules | ||
RUN ls -l /app | ||
|
||
# Add lockfile and package.json's of isolated subworkspace | ||
FROM base AS installer | ||
RUN apk add --no-cache libc6-compat | ||
RUN apk update | ||
WORKDIR /app | ||
|
||
# First install dependencies (as they change less often) | ||
COPY .gitignore .gitignore | ||
COPY --from=builder /app/out/json/ . | ||
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml | ||
RUN pnpm i | ||
|
||
# # Build the project and its dependencies | ||
COPY --from=builder /app/out/full/ . | ||
COPY turbo.json turbo.json | ||
|
||
# Uncomment and use build args to enable remote caching | ||
# ARG TURBO_TEAM | ||
# ENV TURBO_TEAM=$TURBO_TEAM | ||
|
||
# ARG TURBO_TOKEN | ||
# ENV TURBO_TOKEN=$TURBO_TOKEN | ||
|
||
RUN turbo run build --filter=api-v2... | ||
|
||
FROM base AS runner | ||
WORKDIR /app | ||
|
||
# Don't run production as root | ||
RUN addgroup --system --gid 1001 expressjs | ||
RUN adduser --system --uid 1001 expressjs | ||
USER expressjs | ||
COPY --from=installer /app . | ||
|
||
CMD node apps/api-v2/dist/index.js |
File renamed without changes.
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,10 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
roots: ['<rootDir>/src'], | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest', | ||
}, | ||
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$', | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], | ||
}; |
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,62 @@ | ||
{ | ||
"name": "api-v2", | ||
"version": "1.0.0", | ||
"description": "", | ||
"scripts": { | ||
"test": "jest --forceExit", | ||
"pretest": "npm run setup", | ||
"start": "node dist/index.js", | ||
"build": "tsup src/index.ts --format cjs --minify --clean", | ||
"prebuild": "npm run clean && npm run schema:generate", | ||
"clean": "rm -rf dist", | ||
"predev": "npm run db:start", | ||
"dev": "NODE_ENV=development tsx src/index.ts", | ||
"db:diff": "prisma migrate dev", | ||
"db:migrate": "prisma migrate deploy", | ||
"schema:generate": "prisma generate", | ||
"db:start": "docker-compose up -d", | ||
"db:setup": "npm run db:start && npm run db:migrate" | ||
}, | ||
"keywords": [], | ||
"author": "Vincent Vu <[email protected]>", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@supernova/types": "workspace:*", | ||
"@types/cookie-parser": "^1.4.4", | ||
"@types/cors": "^2.8.14", | ||
"@types/express": "^4.17.17", | ||
"@types/express-session": "^1.17.7", | ||
"@types/jest": "^29.5.4", | ||
"@types/jsonwebtoken": "^9.0.2", | ||
"@types/node": "^20.6.0", | ||
"@types/passport": "^1.0.12", | ||
"@types/passport-google-oauth20": "^2.0.11", | ||
"@types/supertest": "^2.0.12", | ||
"jest": "^29.6.4", | ||
"jest-express": "^1.12.0", | ||
"prisma": "^5.2.0", | ||
"supertest": "^6.3.3", | ||
"ts-jest": "^29.1.1", | ||
"tsup": "^7.2.0", | ||
"tsx": "^3.12.8", | ||
"typescript": "5.1.6" | ||
}, | ||
"dependencies": { | ||
"@axiomhq/pino": "^0.1.3", | ||
"@prisma/client": "5.2.0", | ||
"cookie-parser": "^1.4.6", | ||
"cors": "^2.8.5", | ||
"dotenv": "^16.3.1", | ||
"express": "^4.18.2", | ||
"express-session": "^1.17.3", | ||
"jsonwebtoken": "^9.0.2", | ||
"passport": "^0.6.0", | ||
"passport-google-oauth20": "^2.0.0", | ||
"pino": "^8.15.1", | ||
"pino-http": "^8.5.0", | ||
"pino-pretty": "^10.2.0", | ||
"redis": "^4.6.8", | ||
"znv": "^0.4.0", | ||
"zod": "^3.22.2" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
apps/api-v2/prisma/migrations/20230909194727_create_user/migration.sql
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,9 @@ | ||
-- CreateTable | ||
CREATE TABLE `User` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`email` VARCHAR(191) NOT NULL, | ||
`name` VARCHAR(191) NULL, | ||
|
||
UNIQUE INDEX `User_email_key`(`email`), | ||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; |
10 changes: 10 additions & 0 deletions
10
apps/api-v2/prisma/migrations/20230909195415_change_id/migration.sql
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,10 @@ | ||
/* | ||
Warnings: | ||
- The primary key for the `User` table will be changed. If it partially fails, the table could be left without primary key constraint. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE `User` DROP PRIMARY KEY, | ||
MODIFY `id` VARCHAR(191) NOT NULL, | ||
ADD PRIMARY KEY (`id`); |
15 changes: 15 additions & 0 deletions
15
apps/api-v2/prisma/migrations/20230910052218_tasks/migration.sql
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,15 @@ | ||
-- CreateTable | ||
CREATE TABLE `Task` ( | ||
`id` VARCHAR(191) NOT NULL, | ||
`title` VARCHAR(191) NOT NULL, | ||
`description` VARCHAR(191) NULL, | ||
`done` BOOLEAN NOT NULL DEFAULT false, | ||
`startAt` DATETIME(3) NULL, | ||
`expectedDurationSeconds` INTEGER NULL, | ||
`userId` VARCHAR(191) NOT NULL, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE `Task` ADD CONSTRAINT `Task_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; |
5 changes: 5 additions & 0 deletions
5
apps/api-v2/prisma/migrations/20230913181514_remove_task_user_fk/migration.sql
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,5 @@ | ||
-- DropForeignKey | ||
ALTER TABLE `Task` DROP FOREIGN KEY `Task_userId_fkey`; | ||
|
||
-- RenameIndex | ||
ALTER TABLE `Task` RENAME INDEX `Task_userId_fkey` TO `owner_id_idx`; |
8 changes: 8 additions & 0 deletions
8
apps/api-v2/prisma/migrations/20230913194341_add_original_build_text_column/migration.sql
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,8 @@ | ||
/* | ||
Warnings: | ||
- Added the required column `originalBuildText` to the `Task` table without a default value. This is not possible if the table is not empty. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE `Task` ADD COLUMN `originalBuildText` VARCHAR(191) NOT NULL; |
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,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "mysql" |
Oops, something went wrong.
046f342
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
supernova-desktop-v2 – ./apps/desktop-v2
supernova-desktop-v2.vercel.app
supernova-desktop-v2-git-main-trysupernova.vercel.app
web.trysupernova.one
supernova-desktop-v2-trysupernova.vercel.app