Skip to content

Commit 9cb8c62

Browse files
author
Bitgame Developer
committed
Initial commit: Bitgame - Blockchain Gaming Platform with Stacks integration
1 parent 22096e5 commit 9cb8c62

File tree

135 files changed

+3580
-5319
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+3580
-5319
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<!-- 90da50ec-9cc4-48d8-9ec9-6bba32957580 5b0adcba-53da-4907-a2e8-edfa5fe15ddf -->
2+
# Fix API: Convert TypeScript to JavaScript Only
3+
4+
## Scope
5+
6+
**HANYA mengubah API backend** - Frontend, tampilan, dan gameplay TIDAK DIUBAH
7+
8+
## Changes
9+
10+
### 1. Create JavaScript API Files
11+
12+
**File: `api/feed.js`** (NEW)
13+
14+
```javascript
15+
module.exports = async (req, res) => {
16+
res.setHeader('Access-Control-Allow-Credentials', 'true');
17+
res.setHeader('Access-Control-Allow-Origin', '*');
18+
res.setHeader('Access-Control-Allow-Methods', 'GET,OPTIONS,POST,PUT');
19+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
20+
21+
if (req.method === 'OPTIONS') {
22+
return res.status(200).end();
23+
}
24+
25+
try {
26+
const mockPosts = [
27+
{
28+
_id: '1',
29+
type: 'score',
30+
author: {
31+
address: 'ST3RHRNAVPT5ATP2JWJXAB836TV559GPCYCRTVGJR',
32+
username: 'testuser',
33+
avatar: null
34+
},
35+
content: 'Just scored 100 points in Snake! 🐍',
36+
game: {
37+
slug: 'snake',
38+
name: 'Snake',
39+
thumbnail: '/games/snake-thumb.png'
40+
},
41+
score: 100,
42+
likes: 5,
43+
tips: [],
44+
createdAt: new Date().toISOString()
45+
}
46+
];
47+
48+
return res.status(200).json(mockPosts);
49+
} catch (error) {
50+
console.error('Feed error:', error);
51+
return res.status(500).json({ error: 'Failed to fetch feed' });
52+
}
53+
};
54+
```
55+
56+
**File: `api/health.js`** (NEW)
57+
58+
```javascript
59+
module.exports = async (req, res) => {
60+
res.setHeader('Access-Control-Allow-Origin', '*');
61+
return res.status(200).json({
62+
status: 'ok',
63+
timestamp: new Date().toISOString(),
64+
message: 'API is working'
65+
});
66+
};
67+
```
68+
69+
### 2. Update Vercel Config
70+
71+
Update `vercel.json` line 7-15:
72+
73+
```json
74+
"rewrites": [
75+
{
76+
"source": "/api/feed",
77+
"destination": "/api/feed.js"
78+
},
79+
{
80+
"source": "/api/health",
81+
"destination": "/api/health.js"
82+
},
83+
{
84+
"source": "/(.*)",
85+
"destination": "/apps/web/dist/$1"
86+
}
87+
]
88+
```
89+
90+
### 3. Remove Old TypeScript Files
91+
92+
Delete:
93+
94+
- `api/feed.ts`
95+
- `api/health.ts`
96+
97+
### 4. Deploy
98+
99+
Run `vercel --prod` to deploy
100+
101+
## What WILL Change
102+
103+
- ✅ API endpoints akan bekerja (tidak crash lagi)
104+
- ✅ Feed akan load dengan mock data
105+
106+
## What WILL NOT Change
107+
108+
- ❌ Frontend code (React components)
109+
- ❌ Tampilan UI/UX
110+
- ❌ Gameplay mechanics
111+
- ❌ Games (Snake, Tic-tac-toe, etc)
112+
- ❌ Styling/CSS
113+
- ❌ User experience
114+
115+
Frontend tetap 100% sama, hanya backend API yang diperbaiki!

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@
3434

3535

3636

37+

.gitignore

Lines changed: 17 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,30 @@
11
# Dependencies
22
node_modules/
3-
pnpm-lock.yaml
3+
.pnp
4+
.pnp.js
45

5-
# Build outputs
6+
# Testing
7+
coverage/
8+
9+
# Production
610
dist/
711
build/
8-
*.tsbuildinfo
912

10-
# Environment variables
13+
# Environment
1114
.env
1215
.env.local
1316
.env.development.local
1417
.env.test.local
1518
.env.production.local
1619

1720
# Logs
18-
logs
19-
*.log
2021
npm-debug.log*
2122
yarn-debug.log*
2223
yarn-error.log*
2324
pnpm-debug.log*
2425
lerna-debug.log*
2526

26-
# Runtime data
27-
pids
28-
*.pid
29-
*.seed
30-
*.pid.lock
31-
32-
# Coverage directory used by tools like istanbul
33-
coverage/
34-
*.lcov
35-
36-
# nyc test coverage
37-
.nyc_output
38-
39-
# Dependency directories
40-
node_modules/
41-
jspm_packages/
42-
43-
# Optional npm cache directory
44-
.npm
45-
46-
# Optional eslint cache
47-
.eslintcache
48-
49-
# Optional REPL history
50-
.node_repl_history
51-
52-
# Output of 'npm pack'
53-
*.tgz
54-
55-
# Yarn Integrity file
56-
.yarn-integrity
57-
58-
# dotenv environment variables file
59-
.env
60-
.env.test
61-
62-
# parcel-bundler cache (https://parceljs.org/)
63-
.cache
64-
.parcel-cache
65-
66-
# Next.js build output
67-
.next
68-
69-
# Nuxt.js build / generate output
70-
.nuxt
71-
dist
72-
73-
# Gatsby files
74-
.cache/
75-
public
76-
77-
# Storybook build outputs
78-
.out
79-
.storybook-out
80-
81-
# Temporary folders
82-
tmp/
83-
temp/
84-
85-
# Editor directories and files
27+
# Editor
8628
.vscode/*
8729
!.vscode/extensions.json
8830
.idea
@@ -93,14 +35,14 @@ temp/
9335
*.sln
9436
*.sw?
9537

96-
# OS generated files
97-
Thumbs.db
98-
ehthumbs.db
99-
Desktop.ini
38+
# Clarinet
39+
.cache/
40+
history.txt
41+
costs-reports.txt
42+
43+
# Synced games
44+
apps/web/public/games-host/
45+
10046

101-
# Netlify
102-
.netlify/
10347

104-
# Test files
105-
test-*.html
106-
debug-*.js
48+
.vercel

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ auto-install-peers=true
55

66

77

8+

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ pnpm-lock.yaml
88

99

1010

11+

.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111

1212

1313

14+

.vercelignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ games-external
1515
test-*.html
1616
*.md
1717
LICENSE
18+

.vscode/extensions.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111

1212

1313

14+

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,4 @@ Thank you for making Bitgame better! 🎮✨
219219

220220

221221

222+

0 commit comments

Comments
 (0)