Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
beeman committed Jan 22, 2024
0 parents commit 55879ee
Show file tree
Hide file tree
Showing 699 changed files with 44,433 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
node_modules
tmp
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
60 changes: 60 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# API Url
API_URL=http://localhost:3000/api
# Discord Admin IDs (comma-separated)
#AUTH_DISCORD_ADMIN_IDS=
# Discord OAuth2 client ID and secret
#AUTH_DISCORD_CLIENT_ID=
#AUTH_DISCORD_CLIENT_SECRET=
# Enable login with Discord
#AUTH_DISCORD_ENABLED=true
# GitHub Admin IDs (comma-separated)
#AUTH_GITHUB_ADMIN_IDS=
# GitHub OAuth2 client ID and secret
#AUTH_GITHUB_CLIENT_ID=
#AUTH_GITHUB_CLIENT_SECRET=
# Enable login with GitHub
#AUTH_GITHUB_ENABLED=true
# Google Admin IDs (comma-separated)
#AUTH_GOOGLE_ADMIN_IDS=
# Google OAuth
#AUTH_GOOGLE_CLIENT_ID=
#AUTH_GOOGLE_CLIENT_SECRET=
# Enable login with Google
#AUTH_GOOGLE_ENABLED=true
# Twitter Admin IDs (comma-separated)
#AUTH_TWITTER_ADMIN_IDS=386584531353862154
# Twitter OAuth2 Consumer Key and Consumer Secret
#AUTH_TWITTER_CONSUMER_KEY=
#AUTH_TWITTER_CONSUMER_SECRET=
# Enable login with Twitter
#AUTH_TWITTER_ENABLED=true
# Enable login with password
AUTH_PASSWORD_ENABLED=true
# Enable user registration
AUTH_REGISTER_ENABLED=true
# Solana accounts that get the Admin role (comma-separated)
AUTH_SOLANA_ADMIN_IDS=
# Enable login with Solana
AUTH_SOLANA_ENABLED=true
# Domains to allow cookies for (comma-separated)
COOKIE_DOMAINS=localhost,127.0.0.1
# URL of the database to connect to
DATABASE_URL="postgresql://pubkey-link:pubkey-link@localhost:5432/pubkey-link?schema=public"
# Enable database provisioning
DATABASE_PROVISION=true
# Enable database reset on each startup
DATABASE_RESET=false
# Enable GraphQL Playground
GRAPHQL_PLAYGROUND=true
# JWT Secret (generate a random string with `openssl rand -hex 32`)
JWT_SECRET=
# Host to listen on
HOST=127.0.0.1
# Port to listen on
PORT=3000
# Session Secret (generate a random string with `openssl rand -hex 32`)
SESSION_SECRET=
# The URL of the Web UI, used to redirect to the Web UI after login.
# In a typical deployment, this is the same as the API_URL with the '/api' suffix removed (the default).
# This means you will probably only need to set this if you are running a local development setup.
WEB_URL=http://localhost:4200
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
libs/sdk/src/generated/*
tmp
55 changes: 55 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"overrides": [
// Opinionated defaults, feel free to change in your own projects
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
// Only allow function declarations and not const fn = () => {}
"func-style": ["error", "declaration"]
}
},
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"env": {
"jest": true
},
"rules": {}
},
{
"files": "*.json",
"parser": "jsonc-eslint-parser",
"rules": {}
}
]
}
64 changes: 64 additions & 0 deletions .github/workflows/build-publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Docker Build and Publish

on:
push:
branches:
- dev
- main
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker (dev)
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
if: github.ref == 'refs/heads/dev'
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:dev
labels: ${{ steps.meta.outputs.labels }}
- name: Build and push Docker (main)
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
if: github.ref == 'refs/heads/main'
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}
- name: Build and push Docker (Manual)
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
if: github.event_name == 'workflow_dispatch'
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
labels: ${{ steps.meta.outputs.labels }}
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI

on:
push:
branches:
- main
pull_request:

env:
API_URL: http://localhost:3000/api
DATABASE_URL: postgresql://pubkey-link:pubkey-link@localhost:5432/pubkey-link?schema=public
DATABASE_PROVISION: true
DATABASE_RESET: true
PORT: 3000

jobs:
main:
name: Nx Cloud - Main Job
uses: nrwl/ci/.github/workflows/[email protected]
with:
node-version: 20.10.0
main-branch-name: main
number-of-agents: 3
init-commands: |
pnpm prisma generate
pnpm nx-cloud start-ci-run --stop-agents-after="build" --agent-count=3
parallel-commands: |
pnpm nx-cloud record -- pnpm nx format:check
parallel-commands-on-agents: |
pnpm nx affected --target=lint --parallel=3
pnpm nx affected --target=test --parallel=3 --ci --code-coverage --exclude anchor
pnpm nx affected --target=build --parallel=3
agents:
name: Nx Cloud - Agents
uses: nrwl/ci/.github/workflows/[email protected]
with:
node-version: 20.10.0
number-of-agents: 3
install-commands: |
pnpm install --frozen-lockfile
pnpm prisma generate
54 changes: 54 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: E2E

on:
push:
branches:
- main
pull_request:

env:
API_URL: http://localhost:3000/api
DATABASE_URL: postgresql://pubkey-link:pubkey-link@localhost:5432/pubkey-link?schema=public
DATABASE_PROVISION: true
DATABASE_RESET: true
HOST: 127.0.0.1
JWT_SECRET: 1dfe5003518560c6362eab48f8220edf8708bbc67efbd4ed8cdf621965e938ee
PORT: 3000
SESSION_SECRET: 1dfe5003518560c6362eab48f8220edf8708bbc67efbd4ed8cdf621965e938ee

jobs:
main-e2e:
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_USER: pubkey-link
POSTGRES_PASSWORD: pubkey-link
POSTGRES_DB: pubkey-link
ports: ['5432:5432']
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis:7-alpine
ports: ['6379:6379']
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/checkout@v3
name: Checkout [main]
with:
fetch-depth: 0
- uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: pnpm install --frozen-lockfile --prefer-frozen-lockfile
- run: pnpm prisma generate
- run: pnpm prisma db push --skip-generate
- run: pnpm nx run-many --target=build --all --parallel --skip-nx-cache --verbose
- run: pnpm nx e2e api-e2e --skip-nx-cache --verbose
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
dist
tmp
/out-tsc
# dependencies
node_modules
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
.env
# System Files
.DS_Store
Thumbs.db
.nx/cache
.anchor
libs/anchor/target/deploy
libs/anchor/target/debug
libs/anchor/target/release
libs/anchor/target/sbf-solana-solana
libs/anchor/target/.rustc_info.json
!libs/anchor/target/idl/*.json
!libs/anchor/target/types/*.ts
test-ledger
.yarn
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm lint-staged
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm nx format:check
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
strict-peer-dependencies=false
auto-install-peers=true
13 changes: 13 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Add files here to ignore them from prettier formatting

/dist
/coverage
tmp
/.nx/cache
pnpm-lock.yaml
.anchor
target
node_modules
dist
build
test-ledger
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": true,
"printWidth": 120,
"semi": false,
"trailingComma": "all",
"arrowParens": "always"
}
12 changes: 12 additions & 0 deletions .run/dev_api.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="dev:api" type="js.build_tools.npm" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="dev:api" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>
Loading

0 comments on commit 55879ee

Please sign in to comment.