Skip to content

feat: added mines game backend, modified backend folder structure and… #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 61 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
65f095a
Merge pull request #3 from SauravBeginner/ui_fixed
hkirat May 22, 2024
cdcd26e
feat: added mines game backend, modified backend folder structure and…
nimit9 Jul 14, 2024
53a1ca2
feat: added mines game backend, modified backend folder structure and…
nimit9 Jul 14, 2024
0bd5383
feat: added limbo game
nimit9 Jul 14, 2024
34886fb
feat: added limbo game
nimit9 Jul 14, 2024
ad79acd
fix: dont need to pass cursor
nimit9 Jul 14, 2024
009f225
fix: dont need to pass cursor
nimit9 Jul 14, 2024
3677b1d
fix: modified Plinkoo to use rng seeding
nimit9 Jul 14, 2024
6d059c9
fix: modified Plinkoo to use rng seeding
nimit9 Jul 14, 2024
e8b91f0
added dice and keno backend
nimit9 Jul 19, 2024
f10db08
added dice and keno backend
nimit9 Jul 19, 2024
7002e4c
feat: initialize project structure with frontend and backend setup, i…
nimit9 Mar 14, 2025
523dbcf
chore: remove obsolete audio assets including images, videos, and doc…
nimit9 Mar 14, 2025
2c96fd1
Merge branch 'main' of github.com:nimit9/plinkoo
nimit9 Mar 14, 2025
6b31292
Revert "Merge branch 'main' of github.com:nimit9/plinkoo"
nimit9 Mar 14, 2025
361f240
chore: update pnpm-lock.yaml with new Radix UI packages and versions;…
nimit9 Mar 15, 2025
f86141b
feat: enhance dice betting functionality by adding bet amount validat…
nimit9 Mar 15, 2025
c497196
refactor: standardize import statements and formatting in routeTree.g…
nimit9 Mar 15, 2025
de10493
feat: implement provably fair system with seed management, verificati…
nimit9 Mar 17, 2025
0e73d4b
feat: add functionality to reveal server seed by its hash, including …
nimit9 Mar 18, 2025
b634bdc
refactor: remove RevealedSeed component and update database schema wi…
nimit9 Mar 18, 2025
c7d5877
fix: update button styling in UnhashServerSeed component for improved…
nimit9 Mar 18, 2025
4c484c4
feat: add fetch bets list api and added ui on FE
nimit9 Mar 20, 2025
c77fcec
refactor: update betting functionality to handle amounts in cents, en…
nimit9 Mar 21, 2025
fb0134a
feat: implement roulette game components including betting controls, …
nimit9 Mar 22, 2025
4b18d65
refactor: remove unnecessary React imports from multiple components t…
nimit9 Mar 22, 2025
fed62c7
feat: implement new betting components and enhance drag-and-drop func…
nimit9 Mar 22, 2025
1672b8d
refactor: simplify betting component labels and enhance hover effects…
nimit9 Mar 22, 2025
76ba4da
feat: enhance roulette betting functionality with improved state mana…
nimit9 Mar 23, 2025
8255b5a
fix: correct betId assignment in BottomNumberBets component and remov…
nimit9 Mar 23, 2025
4ece0db
refactor: streamline imports and enhance type usage across various co…
nimit9 Mar 23, 2025
8fbe0dd
refactor: remove balance store and transition to react-query for bala…
nimit9 Mar 29, 2025
0c07510
feat: integrate framer-motion for enhanced animations in roulette gam…
nimit9 Mar 31, 2025
e442807
feat: implement mines game functionality with enhanced validation, us…
nimit9 Mar 31, 2025
85423aa
feat: add mines game integration with enhanced API responses, user au…
nimit9 Apr 3, 2025
3b354b1
Setup husky and lint-staged for pre-commit checks
nimit9 Apr 3, 2025
dbb3444
refactor: update user balance handling to store as string and improve…
nimit9 Apr 5, 2025
ec1f807
refactor: standardize code formatting and improve consistency across …
nimit9 Apr 12, 2025
187db55
chore: add GitHub Actions workflow for linting and formatting on pull…
nimit9 Apr 12, 2025
6c368a8
feat: add GitHub Actions workflow for deploying frontend to S3 and Cl…
nimit9 Apr 13, 2025
6ebcd4e
chore: remove cache configuration for PNPM in frontend deployment wor…
nimit9 Apr 13, 2025
93216b4
feat: add GitHub Actions workflow for deploying backend to production…
nimit9 Apr 13, 2025
bec96ae
feat: add Dockerfile for API service setup, including Node.js environ…
nimit9 Apr 13, 2025
cf44b3e
feat: add TypeScript configuration file for compiler options and modu…
nimit9 Apr 13, 2025
62a3c33
fix: update SSH configuration in backend deployment workflow to use s…
nimit9 Apr 13, 2025
c7fbebc
feat: add build step for API service in Dockerfile to ensure proper c…
nimit9 Apr 13, 2025
ccc1457
chore: add .dockerignore file to exclude unnecessary files from Docke…
nimit9 Apr 13, 2025
617643e
chore: update Dockerfile.api to install OpenSSL 1.1 and other require…
nimit9 Apr 13, 2025
c4c26ff
chore: update Dockerfile.api to use node:22-slim and install OpenSSL …
nimit9 Apr 13, 2025
f06fe23
chore: add VITE_APP_API_URL to environment variables in turbo.json fo…
nimit9 Apr 13, 2025
3f67647
chore: add vercel.json configuration file for routing setup in fronte…
nimit9 Apr 13, 2025
f18d4ec
chore: update deployment workflows to trigger on 'dont-deploy' branch…
nimit9 Apr 13, 2025
b04c79c
chore: update text sizes in various components for improved readabili…
nimit9 May 10, 2025
fccef22
chore: add db:migrate script to package.json and update packageManage…
nimit9 May 10, 2025
e2e20bb
feat(keno): implement keno game functionality and UI components
nimit9 May 10, 2025
b724952
feat(keno): implement betting functionality with user balance checks …
nimit9 May 10, 2025
6aec100
feat(keno): enhance betting functionality with request validation and…
nimit9 May 11, 2025
5a142f7
feat(keno): add Keno game support with UI components and verification…
nimit9 May 11, 2025
cd20501
feat(blackjack): implement initial Blackjack game functionality with …
nimit9 May 11, 2025
12e4a82
feat(blackjack): add Blackjack game implementation with betting contr…
nimit9 May 27, 2025
b92f01d
feat(blackjack): implement comprehensive Blackjack game features incl…
nimit9 Jun 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
41 changes: 41 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Dependencies
node_modules
.pnpm-store

# Lockfile backups
pnpm-lock.yaml.bak

# Build outputs
dist
build
.next
.turbo

# Git
.git
.gitignore

# Environment
.env*
!.env.example

# Docker
.dockerignore
**/Dockerfile
docker-compose.yml

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

# System Files
.DS_Store
Thumbs.db

# Testing
coverage

# Cache
.eslintcache
77 changes: 77 additions & 0 deletions .github/workflows/backend-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Deploy Backend to Production

on:
push:
branches:
- dont-deploy
paths:
- 'apps/api/**'
- 'packages/**'
- 'pnpm-lock.yaml'
- '.github/workflows/backend-deploy.yml'
- 'Docker/Dockerfile.api'
workflow_dispatch: # Allow manual triggering

jobs:
deploy:
name: Build and Deploy Backend
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: ./Docker/Dockerfile.api
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/simcasino-api:latest
${{ secrets.DOCKER_USERNAME }}/simcasino-api:${{ github.sha }}

- name: Deploy to EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
# Pull the latest image
docker pull ${{ secrets.DOCKER_USERNAME }}/simcasino-api:latest

# Stop and remove the old container
docker stop simcasino-api || true
docker rm simcasino-api || true

# Run the new container
docker run -d \
--name simcasino-api \
--restart always \
-p 5000:5000 \
-e NODE_ENV=production \
-e DATABASE_URL="${{ secrets.DATABASE_URL }}" \
-e COOKIE_SECRET="${{ secrets.COOKIE_SECRET }}" \
-e CORS_ORIGIN="${{ secrets.CORS_ORIGIN }}" \
-e GOOGLE_CLIENT_ID="${{ secrets.GOOGLE_CLIENT_ID }}" \
-e GOOGLE_CLIENT_SECRET="${{ secrets.GOOGLE_CLIENT_SECRET }}" \
-e CLIENT_URL="${{ secrets.CLIENT_URL }}" \
-e REDIRECT_URL="${{ secrets.REDIRECT_URL }}" \
${{ secrets.DOCKER_USERNAME }}/simcasino-api:latest

- name: Deployment Notification
if: success()
run: |
echo "Backend successfully deployed to production."
echo "Commit: ${GITHUB_SHA::7}"
echo "Branch: ${GITHUB_REF#refs/heads/}"
87 changes: 87 additions & 0 deletions .github/workflows/frontend-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Deploy Frontend to S3 and CloudFront

on:
push:
branches:
- dont-deploy
paths:
- 'apps/frontend/**'
- 'packages/**'
- 'pnpm-lock.yaml'
- '.github/workflows/frontend-deploy.yml'
workflow_dispatch: # Allow manual triggering

env:
NODE_VERSION: 22.14.0 # Latest LTS version
PNPM_VERSION: 9.9.0

jobs:
build-and-deploy:
name: Build and Deploy Frontend
runs-on: ubuntu-latest
permissions:
id-token: write # Needed for AWS OIDC authentication
contents: read

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install PNPM
run: npm install -g pnpm@${{ env.PNPM_VERSION }}

- name: Setup Environment Variables
run: |
echo "VITE_APP_API_URL=${{ secrets.VITE_APP_API_URL }}" >> .env
echo "VITE_APP_VERSION=${GITHUB_SHA::7}" >> .env
echo "VITE_APP_ENVIRONMENT=production" >> .env
working-directory: ./apps/frontend

- name: Install Dependencies
run: pnpm install --frozen-lockfile

- name: Build Frontend
run: pnpm run build --filter=frontend

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Deploy to S3
run: |
aws s3 sync ./apps/frontend/dist/ s3://${{ secrets.S3_BUCKET_NAME }}/ \
--delete \
--cache-control "max-age=31536000,public" \
--exclude "*.html" \
--exclude "robots.txt" \
--exclude "sitemap.xml"

# Upload HTML files with different cache settings
aws s3 sync ./apps/frontend/dist/ s3://${{ secrets.S3_BUCKET_NAME }}/ \
--cache-control "max-age=0,no-cache,no-store,must-revalidate" \
--content-type "text/html" \
--exclude "*" \
--include "*.html" \
--include "robots.txt" \
--include "sitemap.xml"

- name: Invalidate CloudFront Distribution
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} \
--paths "/*"

- name: Deployment Notification
if: success()
run: |
echo "Frontend successfully deployed to production."
echo "Commit: ${GITHUB_SHA::7}"
echo "Branch: ${GITHUB_REF#refs/heads/}"
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Linting and Formatting the PR

on:
pull_request:
branches:
- '**'

jobs:
Continuous-Integration:
name: Performs linting and formatting on the PR
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
- name: Install dependencies
run: pnpm install
- name: Lint
run: pnpm lint
- name: Format
run: pnpm format
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.DS_Store
node_modules
.turbo
*.log
.next
dist
dist-ssr
*.local
.env
.cache
server/dist
public/dist
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# Run lint-staged to check staged files
npx lint-staged
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
auto-install-peers = true
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"printWidth": 80,
"arrowParens": "avoid"
}
17 changes: 17 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"eslint.workingDirectories": [
{
"mode": "auto"
}
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
},
"editor.formatOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
]
}
35 changes: 35 additions & 0 deletions Docker/Dockerfile.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM node:22-slim

# 🛠 Install OpenSSL 1.1 (needed by Prisma) and other required packages
RUN apt-get update && apt-get install -y \
openssl \
libssl-dev \
libstdc++6 \
zlib1g \
bash \
&& rm -rf /var/lib/apt/lists/*

RUN npm install -g [email protected]

WORKDIR /usr/src/app

COPY ./packages ./packages
COPY ./pnpm-lock.yaml ./pnpm-lock.yaml
COPY ./pnpm-workspace.yaml ./pnpm-workspace.yaml

COPY ./package.json ./package.json
COPY ./tsconfig.json ./tsconfig.json
COPY ./turbo.json ./turbo.json

COPY ./apps/api ./apps/api

RUN pnpm install --frozen-lockfile

# Generate Prisma client
RUN pnpm db:generate

RUN pnpm build --filter=api

WORKDIR /usr/src/app/apps/api

CMD ["pnpm", "start"]
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Turborepo kitchen sink starter

This is an official starter Turborepo with multiple meta-frameworks all working in harmony and sharing packages.

This example also shows how to use [Workspace Configurations](https://turbo.build/repo/docs/core-concepts/monorepos/configuring-workspaces).

## Using this example

Run the following command:

```sh
npx create-turbo@latest -e kitchen-sink
```

## What's inside?

This Turborepo includes the following packages and apps:

### Apps and Packages

- `api`: an [Express](https://expressjs.com/) server
- `storefront`: a [Next.js](https://nextjs.org/) app
- `admin`: a [Vite](https://vitejs.dev/) single page app
- `blog`: a [Remix](https://remix.run/) blog
- `@repo/eslint-config`: ESLint configurations used throughout the monorepo
- `@repo/jest-presets`: Jest configurations
- `@repo/logger`: isomorphic logger (a small wrapper around console.log)
- `@repo/ui`: a dummy React UI library (which contains `<CounterButton>` and `<Link>` components)
- `@repo/typescript-config`: tsconfig.json's used throughout the monorepo

Each package and app is 100% [TypeScript](https://www.typescriptlang.org/).

### Utilities

This Turborepo has some additional tools already setup for you:

- [TypeScript](https://www.typescriptlang.org/) for static type checking
- [ESLint](https://eslint.org/) for code linting
- [Jest](https://jestjs.io) test runner for all things JavaScript
- [Prettier](https://prettier.io) for code formatting
12 changes: 12 additions & 0 deletions apps/api/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
PORT=5000

GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
CLIENT_URL=http://localhost:3000
REDIRECT_URL=/api/v1/auth/google/callback

COOKIE_SECRET=secret

NODE_ENV=development

DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
12 changes: 12 additions & 0 deletions apps/api/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: ['@repo/eslint-config/server.js'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: true,
},
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-misused-promises': 'off',
},
};
1 change: 1 addition & 0 deletions apps/api/dice.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading