diff --git a/.github/workflows/deploy-server.yml b/.github/workflows/deploy-server.yml new file mode 100644 index 0000000..05f6b25 --- /dev/null +++ b/.github/workflows/deploy-server.yml @@ -0,0 +1,29 @@ +name: "Deploy Server" + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 # needed until 18 becomes the default + with: + node-version: 18 + cache: yarn + - name: Install dependencies + run: yarn install --frozen-lockfile + working-directory: ./apps/server + - name: Generate Prisma Client + working-directory: ./apps/server + run: yarn prisma generate + - name: Build + working-directory: ./apps/server + run: yarn build + - uses: superfly/flyctl-actions/setup-flyctl@master + - run: flyctl deploy --remote-only ./apps/server/build + env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} diff --git a/.github/workflows/deploy-web-client.yml b/.github/workflows/deploy-web-client.yml new file mode 100644 index 0000000..4d3922f --- /dev/null +++ b/.github/workflows/deploy-web-client.yml @@ -0,0 +1,32 @@ +name: Deploy Web +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} +on: + push: + branches: + - main +jobs: + Deploy: + defaults: + run: + working-directory: ./apps/app + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 # needed until 18 becomes the default + with: + node-version: 18 + cache: yarn + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Generate Prisma Client + run: cd ../server && yarn prisma generate + - name: Install Vercel CLI + run: npm install --global vercel@canary + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Project Artifacts + run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + - name: Deploy Project Artifacts to Vercel + run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} diff --git a/.github/workflows/tests-and-check.yml b/.github/workflows/tests-and-check.yml new file mode 100644 index 0000000..a97cad5 --- /dev/null +++ b/.github/workflows/tests-and-check.yml @@ -0,0 +1,44 @@ +name: Tests and Checks + +on: [push] + +jobs: + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 # needed until 18 becomes the default + with: + node-version: 18 + cache: yarn + + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Generate Prisma Client + run: cd apps/server && yarn prisma generate + - name: Typecheck + run: yarn ts:check + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 # needed until 18 becomes the default + with: + node-version: 18 + cache: yarn + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Linting + run: yarn lint + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 # needed until 18 becomes the default + with: + node-version: 18 + cache: yarn + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Test + run: yarn test diff --git a/README.md b/README.md index 70d1695..c999d72 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ docker-compose up ```sh # in another tab -cd apps/backend +cd apps/server cp .env.example .env npx @serenity-kit/opaque@latest create-server-setup # copy the string value as OPAQUE_SERVER_SETUP .env @@ -87,8 +87,10 @@ Users use OPAQUE to authenticate with the server. After Login the server creates ## Todos -- fix all ts issues - setup CI (ts:check) -- implement frontend from jumpstart -- implement auth (from jumpstart) +- generate keys and store them locally +- store keys on lockbox - add invitation scheme + +- store data locally (api in secsync) +- fix websocket session auth in secsync diff --git a/apps/app/.gitignore b/apps/app/.gitignore new file mode 100644 index 0000000..7312a5e --- /dev/null +++ b/apps/app/.gitignore @@ -0,0 +1,15 @@ +node_modules/ +.expo/ +dist/ +npm-debug.* +*.jks +*.p8 +*.p12 +*.key +*.mobileprovision +*.orig.* +web-build/ + +# macOS +.DS_Store + diff --git a/apps/app/app.json b/apps/app/app.json index 0cb1ba1..f8ef4e3 100644 --- a/apps/app/app.json +++ b/apps/app/app.json @@ -6,10 +6,10 @@ "scheme": "acme", "version": "1.0.0", "orientation": "portrait", - "icon": "./assets/icon.png", + "icon": "./assets/images/icon.png", "userInterfaceStyle": "light", "splash": { - "image": "./assets/splash.png", + "image": "./assets/images/splash.png", "resizeMode": "contain", "backgroundColor": "#ffffff" }, @@ -20,14 +20,14 @@ }, "android": { "adaptiveIcon": { - "foregroundImage": "./assets/adaptive-icon.png", + "foregroundImage": "./assets/images/adaptive-icon.png", "backgroundColor": "#ffffff" } }, "web": { - "favicon": "./assets/favicon.png" + "favicon": "./assets/images/favicon.png" }, - "plugins": ["expo-router", "expo-asset"], + "plugins": ["expo-router"], "extra": { "router": { "origin": false diff --git a/apps/app/assets/fonts/SpaceMono-Regular.ttf b/apps/app/assets/fonts/SpaceMono-Regular.ttf new file mode 100755 index 0000000..28d7ff7 Binary files /dev/null and b/apps/app/assets/fonts/SpaceMono-Regular.ttf differ diff --git a/apps/app/assets/icon.png b/apps/app/assets/icon.png deleted file mode 100644 index 31fdbf0..0000000 Binary files a/apps/app/assets/icon.png and /dev/null differ diff --git a/apps/app/assets/adaptive-icon.png b/apps/app/assets/images/adaptive-icon.png similarity index 100% rename from apps/app/assets/adaptive-icon.png rename to apps/app/assets/images/adaptive-icon.png diff --git a/apps/app/assets/favicon.png b/apps/app/assets/images/favicon.png similarity index 100% rename from apps/app/assets/favicon.png rename to apps/app/assets/images/favicon.png diff --git a/apps/app/assets/images/icon.png b/apps/app/assets/images/icon.png new file mode 100644 index 0000000..a0b1526 Binary files /dev/null and b/apps/app/assets/images/icon.png differ diff --git a/apps/app/assets/images/partial-react-logo.png b/apps/app/assets/images/partial-react-logo.png new file mode 100644 index 0000000..66fd957 Binary files /dev/null and b/apps/app/assets/images/partial-react-logo.png differ diff --git a/apps/app/assets/images/react-logo.png b/apps/app/assets/images/react-logo.png new file mode 100644 index 0000000..9d72a9f Binary files /dev/null and b/apps/app/assets/images/react-logo.png differ diff --git a/apps/app/assets/images/react-logo@2x.png b/apps/app/assets/images/react-logo@2x.png new file mode 100644 index 0000000..2229b13 Binary files /dev/null and b/apps/app/assets/images/react-logo@2x.png differ diff --git a/apps/app/assets/images/react-logo@3x.png b/apps/app/assets/images/react-logo@3x.png new file mode 100644 index 0000000..a99b203 Binary files /dev/null and b/apps/app/assets/images/react-logo@3x.png differ diff --git a/apps/app/assets/images/splash.png b/apps/app/assets/images/splash.png new file mode 100644 index 0000000..0e89705 Binary files /dev/null and b/apps/app/assets/images/splash.png differ diff --git a/apps/app/assets/splash.png b/apps/app/assets/splash.png deleted file mode 100644 index 4130bbd..0000000 Binary files a/apps/app/assets/splash.png and /dev/null differ diff --git a/apps/app/babel.config.js b/apps/app/babel.config.js index 9d74a33..02f1d10 100644 --- a/apps/app/babel.config.js +++ b/apps/app/babel.config.js @@ -6,5 +6,6 @@ module.exports = (api) => { ["babel-preset-expo", { jsxImportSource: "nativewind" }], "nativewind/babel", ], + plugins: ["react-native-reanimated/plugin"], }; }; diff --git a/apps/app/metro.config.js b/apps/app/metro.config.js index e2423a3..3c80801 100644 --- a/apps/app/metro.config.js +++ b/apps/app/metro.config.js @@ -6,8 +6,9 @@ const { withNativeWind } = require("nativewind/metro"); const path = require("node:path"); +// from https://github.com/nativewind/nativewind/blob/main/examples/expo-router/metro.config.js /** @type {import('expo/metro-config').MetroConfig} */ -const config = getDefaultConfig(__dirname); +const config = getDefaultConfig(__dirname, { isCSSEnabled: true }); config.resolver.unstable_enableSymlinks = true; config.resolver.unstable_enablePackageExports = true; @@ -23,4 +24,8 @@ config.resolver.nodeModulesPaths = [ path.resolve(monorepoRoot, "node_modules"), ]; -module.exports = withNativeWind(config, { input: "./src/global.css" }); +module.exports = withNativeWind(config, { + input: "./src/global.css", + // from https://github.com/nativewind/nativewind/blob/main/examples/expo-router/metro.config.js + inlineRem: false, +}); diff --git a/apps/app/package.json b/apps/app/package.json index cb31748..ce7b18b 100644 --- a/apps/app/package.json +++ b/apps/app/package.json @@ -1,45 +1,52 @@ { "name": "koriko", + "main": "src/AppEntry.ts", "version": "1.0.0", - "main": "./src/AppEntry.ts", "scripts": { "dev": "EXPO_USE_METRO_WORKSPACE_ROOT=1 expo start --dev-client", - "ts:check": "tsc --noEmit" + "ts:check": "tsc --noEmit", + "test": "jest", + "lint": "echo \"Lint not setup\" # expo lint" + }, + "jest": { + "preset": "jest-expo" }, "dependencies": { - "@effect/schema": "^0.67.15", - "@expo/metro-runtime": "~3.2.1", "@expo/vector-icons": "^14.0.0", - "@react-native/assets-registry": "0.75.0-main", + "@react-navigation/native": "^6.0.2", + "@tanstack/react-query": "^5.40.0", + "@trpc/client": "^11.0.0-rc.382", + "@trpc/react-query": "^11.0.0-rc.382", "babel-preset-expo": "~11.0.0", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", - "expo": "51.0.9", - "expo-asset": "~10.0.6", - "expo-clipboard": "~6.0.3", + "expo": "~51.0.9", "expo-constants": "~16.0.2", "expo-crypto": "~13.0.2", "expo-dev-client": "~4.0.15", + "expo-font": "~12.0.6", "expo-linking": "~6.3.1", "expo-router": "~3.5.14", - "expo-sqlite": "~14.0.3", + "expo-splash-screen": "~0.27.4", "expo-standard-web-crypto": "^1.8.1", "expo-status-bar": "~1.12.1", - "fast-text-encoding": "^1.0.6", + "expo-system-ui": "~3.0.4", "lucide-react-native": "^0.381.0", "nativewind": "^4.0.1", "position-strings": "^2.0.1", - "react": "18.3.1", - "react-dom": "^18.2.0", + "react": "18.2.0", + "react-dom": "18.2.0", "react-native": "0.74.1", + "react-native-gesture-handler": "~2.16.1", "react-native-libsodium": "^1.3.1", - "react-native-reanimated": "~3.11.0", - "react-native-safe-area-context": "4.10.3", + "react-native-opaque": "^0.3.1", + "react-native-reanimated": "~3.10.1", + "react-native-safe-area-context": "4.10.1", "react-native-screens": "3.31.1", - "react-native-svg": "15.3.0", - "react-native-web": "~0.19.6", - "secsync-react-yjs": "^0.4.0", + "react-native-svg": "15.2.0", + "react-native-web": "~0.19.10", "secsync": "^0.4.0", + "secsync-react-yjs": "^0.4.0", "tailwind-merge": "^2.3.0", "tailwindcss": "^3.4.0", "tailwindcss-animate": "^1.0.7", @@ -47,19 +54,12 @@ "zustand": "^4.5.2" }, "devDependencies": { - "@babel/core": "^7.24.3", - "@babel/runtime": "^7.24.1", - "@types/react": "~18.3.3", - "babel-plugin-transform-vite-meta-env": "^1.0.3", - "eslint": "^9.3.0", - "husky": "^9.0.11", - "lint-staged": "^15.2.5", - "prettier": "3.2.5", - "prettier-plugin-tailwindcss": "^0.6.0", - "typescript": "~5.4.5" - }, - "resolutions": { - "@effect/schema": "=0.64.16" + "@babel/core": "^7.20.0", + "@types/jest": "^29.5.12", + "@types/react": "~18.2.45", + "jest": "^29.2.1", + "jest-expo": "~51.0.1", + "typescript": "~5.3.3" }, "private": true } diff --git a/apps/app/src/AppEntry.ts b/apps/app/src/AppEntry.ts index e0ee9bb..460fdbd 100644 --- a/apps/app/src/AppEntry.ts +++ b/apps/app/src/AppEntry.ts @@ -1,2 +1,3 @@ -import "expo-router/entry"; import "./polyfill.ts"; +// must to be after the polyfill +import "expo-router/entry"; diff --git a/apps/app/src/app/+html.tsx b/apps/app/src/app/+html.tsx new file mode 100644 index 0000000..2d6b247 --- /dev/null +++ b/apps/app/src/app/+html.tsx @@ -0,0 +1,42 @@ +import { ScrollViewStyleReset } from "expo-router/html"; +import { type PropsWithChildren } from "react"; + +/** + * This file is web-only and used to configure the root HTML for every web page during static rendering. + * The contents of this function only run in Node.js environments and do not have access to the DOM or browser APIs. + */ +export default function Root({ children }: PropsWithChildren) { + return ( + + + + + + + {/* + Disable body scrolling on web. This makes ScrollView components work closer to how they do on native. + However, body scrolling is often nice to have for mobile web. If you want to enable it, remove this line. + */} + + + {/* Using raw CSS styles as an escape-hatch to ensure the background color never flickers in dark-mode. */} +