Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
2e381aa
feat: adding boilerplate
rvalenciano Oct 19, 2024
1c5f514
feature: dockerizing, adding trusted dependencies to run on install
rvalenciano Oct 19, 2024
53e1e16
Add 'cofiblocks-network' to let services to communicate with each other
wugalde19 Jan 27, 2025
5dd905c
Docker compose up runs until here
wugalde19 Jan 27, 2025
84bd8c5
feat: Update '@repo/ui' dependency definition in apps/web/package.jso…
wugalde19 Feb 4, 2025
da7f925
feat: Update web.Dockerfile to make it work with packages like repo/ui
wugalde19 Feb 4, 2025
2c30803
feat: Update web service config in docker compose file
wugalde19 Feb 4, 2025
5d82ed9
feat: Add entrypoint.sh script file to handle @repo/ui link
wugalde19 Feb 4, 2025
e28b5df
feat: Allow prisma to build binary for proper target platform
wugalde19 Feb 4, 2025
5f87702
feat: Force bun to re-link
wugalde19 Feb 4, 2025
da0dd9b
feat: Tell Node.js where to look for modules to fix heroicons issue
wugalde19 Feb 4, 2025
9eb51a4
feat: Update command to run when prisma service starts
wugalde19 Feb 4, 2025
48db4eb
docs: Add docker setup instructions to README
wugalde19 Feb 27, 2025
17b0689
chore: replace 'bcrypt' with 'bcryptjs' to fix build error
wugalde19 Feb 27, 2025
80acfe3
chore: update dependencies to fix build errors
wugalde19 Feb 27, 2025
cefc3f6
chore: add '@t3-oss/env-nextjs' dependency to package.json file
wugalde19 Feb 27, 2025
a8027c9
chore: simplify docker set up for web service to not depend on local …
wugalde19 Feb 27, 2025
6d6b1da
chore: change storybook service port to be 3001
wugalde19 Feb 27, 2025
1eaa1de
chore: fix error related to prisma client when running app with docker
wugalde19 Feb 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules
Dockerfile*
docker-compose*
.dockerignore
.git
.gitignore
README.md
LICENSE
.vscode
Makefile
helm-charts
.env
.editorconfig
.idea
coverage*
37 changes: 37 additions & 0 deletions apps/web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,40 @@ To run the application in development mode, use:
bun turbo dev
```

## Running the Application with Docker

Follow the steps below to set up and run the CofiBlocks web application using Docker.

### 1. Set Up Environment Variables

Create a `.env` file by copying the example configuration:

```bash
cp .env.example .env
```

Then, fill in the required values in the `.env` file:

- **`DATABASE_URL`**: The database connection URL.
- Example for a local MySQL setup:
```
mysql://root:root@127.0.0.1:3306/web
```

### 2. Build and Start the Docker Containers

Ensure Docker is running and execute the following commands to build and start the Docker containers:

```bash
docker-compose down
docker-compose up --build
```

### 3. Access the Application

Once the containers are up and running, you can access the application at:

```
http://localhost:3000
```

Binary file added apps/web/bun.lockb
Binary file not shown.
4 changes: 4 additions & 0 deletions apps/web/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- REPLACE janedoe with your mysql user in the .env

GRANT CREATE ON *.* TO 'janedoe'@'%';
GRANT ALL PRIVILEGES ON *.* TO 'janedoe'@'%';
15 changes: 9 additions & 6 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"type": "module",
"workspaces": ["./packages/*"],
"prisma": {
"schema": "./prisma/schema.prisma",
"seed": "./prisma/seed.js"
Expand All @@ -13,26 +14,27 @@
"db:migrate": "prisma migrate deploy",
"db:push": "prisma db push",
"db:studio": "prisma studio",
"dev": "next dev",
"postinstall": "prisma generate",
"dev": "next dev --hostname 0.0.0.0",
"postinstall": "prisma generate && next build || true",
"lint": "next lint",
"start": "next start",
"dev:storybook": "storybook dev -p 6006",
"build:storybook": "storybook build"
},
"dependencies": {
"@auth/prisma-adapter": "^1.6.0",
"@hookform/resolvers": "^3.3.4",
"@prisma/client": "5.22.0",
"@radix-ui/react-tooltip": "^1.1.8",
"@repo/ui": "*",
"@repo/ui": "workspace:*",
"@starknet-react/chains": "^0.1.7",
"@starknet-react/core": "^2.9.0",
"@t3-oss/env-nextjs": "^0.10.1",
"@tanstack/react-query": "^5.50.0",
"@trpc/client": "^11.0.0-rc.446",
"@trpc/react-query": "^11.0.0-rc.446",
"@trpc/server": "^11.0.0-rc.446",
"bcrypt": "^5.1.1",
"bcryptjs": "^3.0.2",
"framer-motion": "^11.3.30",
"geist": "^1.3.0",
"get-starknet-core": "^3.3.3",
Expand All @@ -42,12 +44,13 @@
"pinata-web3": "^0.5.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hook-form": "^7.51.0",
"react-hot-toast": "^2.5.1",
"react-i18next": "^15.0.2",
"server-only": "^0.0.1",
"starknet": "^6.11.0",
"superjson": "^2.2.1",
"zod": "^3.23.3"
"zod": "^3.22.4"
},
"devDependencies": {
"@chromatic-com/storybook": "^1.9.0",
Expand All @@ -61,7 +64,7 @@
"@storybook/nextjs": "^8.3.0",
"@storybook/react": "^8.3.0",
"@storybook/test": "^8.3.0",
"@types/bcrypt": "^5.0.2",
"@types/bcryptjs": "^2.4.6",
"@types/eslint": "^8.56.10",
"@types/node": "^20.14.10",
"@types/react": "^18.3.3",
Expand Down
1 change: 1 addition & 0 deletions apps/web/prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters"]
binaryTargets = ["native", "linux-arm64-openssl-1.1.x", "debian-openssl-1.1.x", "linux-musl", "darwin-arm64"]
}

datasource db {
Expand Down
2 changes: 2 additions & 0 deletions apps/web/sql/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GRANT CREATE ON *.* TO 'janedoe'@'%';
GRANT ALL PRIVILEGES ON *.* TO 'janedoe'@'%';
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import {
CheckCircleIcon,
ShoppingBagIcon,
TruckIcon,
WalletIcon,
} from "@heroicons/react/24/outline";
import { zodResolver } from "@hookform/resolvers/zod";
Expand Down Expand Up @@ -33,12 +32,6 @@ enum DeliveryTypeEnum {
Delivery = "Delivery",
}

const OrderStatusEnum = {
PENDING: "PENDING",
COMPLETED: "COMPLETED",
CANCELLED: "CANCELLED",
} as const;

const orderStatusSchema = z.object({
status: z.enum(["PENDING", "COMPLETED", "CANCELLED"] as const),
});
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/api/auth/register/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Role } from "@prisma/client";
import { hash } from "bcrypt";
import { hash } from "bcryptjs";
import type { NextRequest } from "next/server";
import { db } from "~/server/db";

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/server/auth.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Role } from "@prisma/client";
import { compare } from "bcrypt";
import { compare } from "bcryptjs";
import type { DefaultSession, NextAuthOptions } from "next-auth";
import { getServerSession } from "next-auth";
import CredentialsProvider from "next-auth/providers/credentials";
Expand Down
Loading
Loading