Skip to content

Commit

Permalink
Merge pull request #1 from nikgraf/add-auth
Browse files Browse the repository at this point in the history
Add auth
  • Loading branch information
nikgraf committed Jun 2, 2024
2 parents 78a44e0 + a020bd2 commit f6283fd
Show file tree
Hide file tree
Showing 56 changed files with 3,436 additions and 521 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/deploy-server.yml
Original file line number Diff line number Diff line change
@@ -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 }}
32 changes: 32 additions & 0 deletions .github/workflows/deploy-web-client.yml
Original file line number Diff line number Diff line change
@@ -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 }}
44 changes: 44 additions & 0 deletions .github/workflows/tests-and-check.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
15 changes: 15 additions & 0 deletions apps/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules/
.expo/
dist/
npm-debug.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/

# macOS
.DS_Store

10 changes: 5 additions & 5 deletions apps/app/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand All @@ -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
Expand Down
Binary file added apps/app/assets/fonts/SpaceMono-Regular.ttf
Binary file not shown.
Binary file removed apps/app/assets/icon.png
Binary file not shown.
File renamed without changes
File renamed without changes
Binary file added apps/app/assets/images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/app/assets/images/partial-react-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/app/assets/images/react-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/app/assets/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/app/assets/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/app/assets/images/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed apps/app/assets/splash.png
Binary file not shown.
1 change: 1 addition & 0 deletions apps/app/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ module.exports = (api) => {
["babel-preset-expo", { jsxImportSource: "nativewind" }],
"nativewind/babel",
],
plugins: ["react-native-reanimated/plugin"],
};
};
9 changes: 7 additions & 2 deletions apps/app/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
});
60 changes: 30 additions & 30 deletions apps/app/package.json
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
{
"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",
"yjs": "^13.6.15",
"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
}
3 changes: 2 additions & 1 deletion apps/app/src/AppEntry.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import "expo-router/entry";
import "./polyfill.ts";
// must to be after the polyfill
import "expo-router/entry";
42 changes: 42 additions & 0 deletions apps/app/src/app/+html.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>

{/*
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.
*/}
<ScrollViewStyleReset />

{/* Using raw CSS styles as an escape-hatch to ensure the background color never flickers in dark-mode. */}
<style dangerouslySetInnerHTML={{ __html: responsiveBackground }} />
{/* Add any additional <head> elements that you want globally available on web... */}
</head>
<body>{children}</body>
</html>
);
}

const responsiveBackground = `
body {
background-color: #fff;
}
@media (prefers-color-scheme: dark) {
body {
background-color: #000;
}
}`;
5 changes: 5 additions & 0 deletions apps/app/src/app/+not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Text } from "react-native";

export default () => {
return <Text>NOT FOUND</Text>;
};
Loading

0 comments on commit f6283fd

Please sign in to comment.