Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jjramirezn committed Feb 19, 2024
0 parents commit da8abc0
Show file tree
Hide file tree
Showing 27 changed files with 7,673 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Main
MODULE_NAME='module'
DEBUG='ndk:*,module:*'

# Express HTTP Server
PORT=3000

# Nostr settings
NOSTR_PRIVATE_KEY="YOUR_NOSTR_PRIVATE_KEY"
NOSTR_PUBLIC_KEY="The public key associated to the private key"
NOSTR_RELAYS="wss://relay.damus.io,wss://relay.hodl.ar,wss://nostr.wine,wss://offchain.pub,wss://nostr-pub.wellorder.net,wss://nos.lol"
NOSTR_WRITE_RELAY=""

# Postgres settings
DATABASE_URL="postgresql://root:root@localhost:5432/lawallet-extension"
5 changes: 5 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
NOSTR_PRIVATE_KEY='82e59e17b3983b6c4246c6c87f3033b03b07d49fa13e82741beaf1a26e0ca381'
NOSTR_PUBLIC_KEY='0ce32219d1fce60df30b59b2b3885edea84341444a422918ff8d6cf641ecfa6b'
NOSTR_RELAYS='wss://relay.lawallet.ar,wss://relay.example.org'
NOSTR_WRITE_RELAY='wss://write.relay.lawallet.ar'
DEBUG='-module'
49 changes: 49 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"env": {
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/strict-type-checked",
"prettier"
],
"ignorePatterns": ["pnpm-lock.yaml", "dist/"],
"overrides": [
{
"files": ["tests/**"],
"plugins": ["jest"],
"extends": ["plugin:jest/recommended"],
"rules": {
"@typescript-eslint/unbound-method": "off",
"jest/unbound-method": "error"
}
}
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.eslint.json"
},
"plugins": ["import", "@typescript-eslint"],
"root": true,
"rules": {
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_"
}
]
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts"]
},
"import/resolver": {
"typescript": {}
}
}
}
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Ignore hidden files
.*
# But pay attention to certain specific ones
!.env.example
!.env.test
!.envrc
!.eslintrc
!.gitattributes
!.gitconfig
!.github
!.gitignore
!.gitkeep
!/**/.gitkeep
!.nvmrc
!.pnp.cjs
!.pnp.loader.mjs
!.prettierignore
!.prettierrc

# Pipeline
node_modules
dist
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.11
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm-lock.yaml
42 changes: 42 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"printWidth": 80,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"overrides": [
{
"files": "*.ts",
"options": {
"parser": "typescript"
}
},
{
"files": "*.md",
"options": {
"parser": "markdown"
}
},
{
"files": "*.mdx",
"options": {
"parser": "mdx"
}
},
{
"files": "*.json",
"options": {
"parser": "json",
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "none"
}
},
{
"files": "*.{yml,yaml}",
"options": {
"parser": "yaml"
}
}
]
}
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM node:20-alpine AS base

RUN ["addgroup", "--system", "--gid", "1001", "nodejs"]
RUN ["adduser" , "--system", "--uid", "1001", "nodejs"]


FROM base AS dependencies

# 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"]
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
COPY prisma/schema.prisma ./prisma/schema.prisma
RUN ["npm", "i", "-g", "pnpm", "prisma"]
RUN ["pnpm", "i", "--frozen-lockfile", "--prod"]
RUN ["pnpm", "add", "-d", "esbuild@^0.20.0"]


FROM base AS build

WORKDIR /app
COPY --from=dependencies /app/node_modules ./node_modules
COPY . .
RUN ["npm", "run", "build:prod"]


FROM base AS runner

WORKDIR /app
COPY --from=build --chown=nodejs:nodejs /app/dist ./dist
COPY --from=build /app/node_modules ./node_modules
USER nodejs
ENV NODE_ENV production
ENV PORT 3000
EXPOSE 3000

ENTRYPOINT ["node", "dist/index.mjs"]
Loading

0 comments on commit da8abc0

Please sign in to comment.