Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
saashqdev committed Oct 31, 2024
0 parents commit 23e6e26
Show file tree
Hide file tree
Showing 704 changed files with 76,412 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Dockerfile
.dockerignore
node_modules
npm-debug.log
README.md
.next
docker
.git
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Environment variables declared in this file are automatically made available to Prisma.
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema

# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings


DATABASE_URL="postgres://<username>:<password>@<host>:<port>/saashq"

59 changes: 59 additions & 0 deletions .env.local.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

##NEXT-AUTH
NEXTAUTH_URL=http://localhost:3000
GOOGLE_ID=
GOOGLE_SECRET=

GITHUB_ID=
GITHUB_SECRET=

#JWT (generate at: https://jwt.io)
JWT_SECRET=

#SMTP
EMAIL_HOST=smtp.resend.com
EMAIL_FROM=info@domain.com
EMAIL_USERNAME=smtp@domain.com
EMAIL_PASSWORD=SuperSEEcretPaSWord123+

#IMAP
IMAP_HOST=imap.domain.com
IMAP_PORT=993
IMAP_USER=user@domain.com
IMAP_PASSWORD=SuperSEEcretPaSWord123+


#NEXT ENV for Client part of App
NEXT_PUBLIC_APP_NAME=SaasHQ
NEXT_PUBLIC_APP_V=0.0.3-beta
NEXT_PUBLIC_APP_URL=http://localhost:3000
NEXT_PUBLIC_NEXT_VERSION="14.0.4"
NEXT_PUBLIC_GITHUB_REPO_URL="https://github.com/saashqdev/saashq"
NEXT_PUBLIC_GITHUB_ISSUES_URL=""
NEXT_PUBLIC_GITHUB_COMMIT_SHA="main"
NEXT_PUBLIC_GITHUB_TOKEN=

#SAASHQ (generate with: openssl rand -base64 32)
SAASHQ_TOKEN=

#OpenAI API
OPEN_AI_ORGANIZATION_ID=
OPEN_AI_API_KEY=
NEXT_PUBLIC_OPENAI_API_KEY=

#Uploadthings
UPLOADTHING_SECRET=
UPLOADTHING_APP_ID=

#rossum
ROSSUM_API_URL=https://elis.rossum.ai/api/v1
ROSSUM_QUEUE_ID=
ROSSUM_USER=
ROSSUM_PASS=

#Discord
NEXT_PUBLIC_DISCORD_INVITE_URL="https://discord.gg/kBhAUKBMgf"

#Resend.com
RESEND_API_KEY=

32 changes: 32 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["autofix", "unused-imports", "@typescript-eslint/eslint-plugin"],
"extends": ["eslint:recommended", "next/core-web-vitals"],
"env": {
"node": true,
"jest": true,
"browser": true
},
"globals": {
"React": true,
"cypress": true
},
"ignorePatterns": [".eslintrc.json"],
"rules": {
"no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"error",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_"
}
],
"autofix/prefer-const": "warn",
"arrow-body-style": ["error", "as-needed"],
"@typescript-eslint/consistent-type-imports": "error",
"react-hooks/exhaustive-deps": "off"
}
}
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: saashqdev
91 changes: 91 additions & 0 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Cypress Tests
on: [push]
jobs:
cypress-run:
runs-on: ubuntu-latest

services:
postgres:
image: postgres

env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: postgres

options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

# Runs tests in parallel with matrix strategy https://docs.cypress.io/guides/guides/parallelization
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
# Also see warning here https://github.com/cypress-io/github-action#parallel
strategy:
fail-fast: false # https://github.com/cypress-io/github-action/issues/48
matrix:
containers: [1, 2] # Uses 2 parallel instances
steps:
- name: Test postgres connection
run: psql postgres://postgres:postgres@localhost:5432/postgres -c 'SELECT 1;'

- name: Create additional database
run: psql postgres://postgres:postgres@localhost:5432/postgres -c 'create database saashq;'

- name: Checkout
uses: actions/checkout@v3

- name: Prisma Schema Validate
uses: elijaholmos/prisma-schema-validate@v1.0.0
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}

- name: Prisma Generate and Push
run: |
npx prisma generate
npx prisma db push
npx prisma db seed
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}

- name: Cypress run
# Uses the official Cypress GitHub action https://github.com/cypress-io/github-action
uses: cypress-io/github-action@v5
with:
# Starts web server for E2E tests - replace with your own server invocation
# https://docs.cypress.io/guides/continuous-integration/introduction#Boot-your-server
build: npm run build
start: npm start
wait-on: "http://localhost:3000" # Waits for above
# Records to Cypress Cloud
# https://docs.cypress.io/guides/cloud/projects#Set-up-a-project-to-record
record: false
parallel: false # Runs test in parallel using settings above
env:
# For recording and parallelization to work you must set your CYPRESS_RECORD_KEY
# in GitHub repo → Settings → Secrets → Actions
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# Creating a token https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOOGLE_ID: ${{ secrets.GOOGLE_ID }}
GOOGLE_SECRET: ${{ secrets.GOOGLE_SECRET }}
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
DO_ENDPOINT: ${{ secrets.DO_ENDPOINT }}
DO_REGION: ${{ secrets.DO_REGION }}
DO_ACCESS_KEY_ID: ${{ secrets.DO_ACCESS_KEY_ID }}
DO_ACCESS_KEY_SECRET: ${{ secrets.DO_ACCESS_KEY_SECRET }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
JWT_SECRET: ${{ secrets.JWT_SECRET }}
SAASHQ_TOKEN: ${{ secrets.SAASHQ_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }}
NEXT_PUBLIC_APP_NAME: ${{ secrets.NEXT_PUBLIC_APP_NAME }}
NEXT_PUBLIC_APP_V: ${{ secrets.NEXT_PUBLIC_APP_V }}
NEXT_PUBLIC_APP_URL: ${{ secrets.NEXT_PUBLIC_APP_URL }}
UPLOADTHING_SECRET: ${{ secrets.UPLOADTHING_SECRET }}
49 changes: 49 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Publish Docker image

on:
push:
branches: ["main"]

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: saashqdev/saashq-0.0.3-beta

- name: Use secrets
run: |
echo "" > .env.local # Clear the .env.local file
echo DATABASE_URL: ${{ secrets.DATABASE_URL }} >> .env
echo GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} >> .env.local
echo GOOGLE_ID: ${{ secrets.GOOGLE_ID }} >> .env.local
echo GOOGLE_SECRET: ${{ secrets.GOOGLE_SECRET }} >> .env.local
echo RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }} >> .env.local
echo DATABASE_URL: ${{ secrets.DATABASE_URL }} >> .env.local
echo JWT_SECRET: ${{ secrets.JWT_SECRET }} >> .env.local
echo NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }} >> .env.local
echo NEXT_PUBLIC_APP_NAME: ${{ secrets.NEXT_PUBLIC_APP_NAME }} >> .env.local
echo NEXT_PUBLIC_APP_V: ${{ secrets.NEXT_PUBLIC_APP_V }} >> .env.local
echo NEXT_PUBLIC_APP_URL: ${{ secrets.NEXT_PUBLIC_APP_URL }} >> .env.local
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: ./Dockerfile_actions # custom Dockerfile name for your github actions
24 changes: 24 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Lint Tests
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '20'
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 8
- name: install
run: pnpm install
- name: Check ESLint
run: pnpm run lint
- name: Check Code Formatting
run: pnpm run format
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js


#jsons
/jsons

/examples

# testing
/coverage
cypress.env.json

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel

backup

# typescript
*.tsbuildinfo
next-env.d.ts
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.17.1
13 changes: 13 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
node_modules
.vscode
prisma
public
rossum
shadcn-examples
Dockerfile*
*.sh
Jenkinsfile
*.yaml
*.yml
*.sql
*.md
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"plugins": ["prettier-plugin-tailwindcss"],
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"endOfLine": "lf",
"printWidth": 80
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"i18n-ally.localesPaths": ["locales"]
}
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM node:20.9.0-alpine AS deps

WORKDIR /app
COPY package*.json ./
RUN npm install

COPY .env .env.local ./

FROM node:20.9.0-alpine AS BUILD_IMAGE

WORKDIR /app

COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npx prisma generate && npx prisma db push && npx prisma db seed && npm run build

RUN rm -rf node_modules
RUN npm install

FROM node:20.9.0-alpine

ENV NODE_ENV production

RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001

WORKDIR /app
COPY --from=BUILD_IMAGE --chown=nextjs:nodejs /app/package.json /app/package-lock.json ./
COPY --from=BUILD_IMAGE --chown=nextjs:nodejs /app/node_modules ./node_modules
COPY --from=BUILD_IMAGE --chown=nextjs:nodejs /app/public ./public
COPY --from=BUILD_IMAGE --chown=nextjs:nodejs /app/.next ./.next


USER nextjs

EXPOSE 3000

CMD [ "npm", "start" ]

#docker build --build-arg ENV_FILE=.env -t myimage .
Loading

0 comments on commit 23e6e26

Please sign in to comment.