-
Notifications
You must be signed in to change notification settings - Fork 0
Installation Guide
Get TTT running locally for development or your own deployment.
No installation needed! Just visit https://stevenfarless.github.io/ttt/
This guide is for developers who want to:
- Contribute to the project
- Host their own version
- Test changes locally
- Use a custom Firebase instance
- Modern web browser - Chrome, Firefox, Safari, or Edge
- Git - For cloning the repository
- (Optional) Code editor - VS Code, Sublime Text, etc.
- (Optional) Local server - For ES6 module support
Note: No build tools, npm, or package managers required! TTT uses vanilla JavaScript.
git clone https://github.com/stevenfarless/ttt.git
cd tttPick the version you want:
# Stable production version (recommended)
git checkout main
# Preview upcoming features
git checkout beta
# Test features in development
git checkout alpha
# Experimental prototypes
git checkout experimental
See Branch Strategy for details on each branch.
Option A: Direct File Opening (Simplest)
Just double-click index.html or drag it into your browser.
Option B: Local Server (Recommended)
ES6 modules require a server. Pick one:
Python 3:
python -m http.server 8000Node.js:
npx http-server
PHP:
php -S localhost:8000VS Code Live Server Extension:
- Install "Live Server" extension
- Right-click
index.html→ "Open with Live Server"
Then visit: http://localhost:8000
See the Firebase Setup guide for step-by-step instructions.
Quick version:
- Create a Firebase project at console.firebase.google.com
- Enable Realtime Database
- Copy your config from Project Settings
- Update
utils.jswith your credentials
ttt/
├── index.html # Lobby page
├── game.html # Game board page
├── style.css # Game styles (gradients, board)
├── home.css # Lobby styles
├── multiplayer.js # Room creation/joining logic
├── game-multiplayer.js # Game logic & Firebase sync
├── utils.js # Firebase config & utilities
├── svg-icons.html # SVG icon definitions
├── README.md # Project documentation
├── CONTRIBUTING.md # Contribution guidelines
└── LICENSE # GPL-3.0 License
Zero JavaScript libraries! TTT uses:
- Vanilla JavaScript (ES6+) - Pure JS, no frameworks
- Firebase SDK - Loaded via CDN (not bundled)
- Native APIs - Clipboard API, Session Storage
The Firebase SDK is loaded from CDN in the HTML files:
<script src="https://www.gstatic.com/firebasejs/9.x.x/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.x.x/firebase-database-compat.js"></script>- ❌ No npm install
- ❌ No webpack/vite/parcel
- ❌ No transpilation
- ❌ No minification (for development)
- ✅ Just clone and open!
Open DevTools (F12) and check for errors:
Good signs:
[MULTIPLAYER] Script loaded at 2025-11-12T...
[MULTIPLAYER] ✅ DOM elements loaded successfully
[MULTIPLAYER] 🎨 Available emojis: ❌ ⭕ ❤️ ...
Bad signs:
Failed to load module script: CORS error
Firebase is not defined
If you see CORS errors → Use a local server (Option B above)
- Click "Create Game"
- Check console for:
[MULTIPLAYER] 🎲 Generated room code: XXXX - If you see Firebase errors → Update your Firebase config in
utils.js
Open two browser windows:
- Window 1: Create a game
- Window 2: Join with the room code
- Both should sync in real-time
Problem: Opening index.html directly triggers CORS restrictions.
Solution: Use a local server (see Option B above).
Problem: Firebase SDK not loading.
Solutions:
- Check your internet connection (CDN requires internet)
- Check browser console for CDN loading errors
- Verify the Firebase SDK script tags in HTML files
Problem: Firebase database rules blocking access.
Solution: In Firebase Console → Realtime Database → Rules, set:
{
"rules": {
".read": true,
".write": true
}
}
Problem: Browser cache or missing CSS files.
Solutions:
- Hard refresh:
Ctrl+Shift+R(Windows) orCmd+Shift+R(Mac) - Clear browser cache
- Check that
style.cssandhome.cssexist in the project directory
Problem: Browser doesn't support ES6 modules or CORS blocking.
Solutions:
- Update your browser to the latest version
- Use a local server instead of opening files directly
- Check that
<script type="module">is in the HTML files
Problem: Using different Firebase instances or configs.
Solution:
- Make sure both browser windows use the same Firebase config
- Check that the room code is correct (case-sensitive)
- Verify Firebase database has the room data (check Firebase Console)
- Edit files in your code editor
- Save changes
-
Refresh browser (
F5orCmd+R) - Check console for errors
- Test thoroughly (see Contributing Guidelines)
- Open two browser windows (or use incognito + regular)
- Window 1: Create game
- Window 2: Join with room code
- Make moves in both windows
- Verify sync - moves should appear instantly in both windows
Console Logging:
TTT has extensive console logging with prefixes:
[MULTIPLAYER] 🎮 Create Game clicked
[MULTIPLAYER] 🎲 Generated room code: AB3X
[MULTIPLAYER] 📤 Creating game with data: {...}Enable debug mode in multiplayer.js:
const DEBUG = true; // Set to false to disable logs
Firebase Debugging:
Check Firebase Console → Realtime Database to see live data:
- View room data structure
- Verify moves are being written
- Check turn and winner values
The Firebase configuration is stored in utils.js:
export const firebaseConfig = {
apiKey: "YOUR_API_KEY",
authDomain: "YOUR_AUTH_DOMAIN",
databaseURL: "YOUR_DATABASE_URL",
projectId: "YOUR_PROJECT_ID",
storageBucket: "YOUR_STORAGE_BUCKET",
messagingSenderId: "YOUR_MESSAGING_ID",
appId: "YOUR_APP_ID"
};For development:
- Use your own Firebase project (free tier works great)
- Never commit your real credentials to public repos
- Use
.gitignoreto exclude config files (if you add them)
For contributors:
- The maintainer's Firebase config is in the repo
- This is intentional (public game, read/write access OK)
- For PRs, use the existing config or your own test instance
See Firebase Setup for creating your own Firebase project.
TTT uses GitHub Pages with GitHub Actions for deployment.
To deploy your fork:
- Fork the repository
- Enable GitHub Pages in Settings
- GitHub Actions will auto-deploy on push
- Visit
https://YOUR-USERNAME.github.io/ttt/
See .github/workflows/deploy-gh-pages.yml for the workflow configuration.
TTT works on any static hosting:
- Netlify - Drag and drop the folder
- Vercel - Connect your Git repo
-
Firebase Hosting -
firebase deploy - AWS S3 - Upload files to bucket
- Your own server - Copy files to web root
No build step needed—just upload the files!
See Contributing Guidelines for:
- Code style guidelines
- Pull request process
- Issue labels
- Testing requirements
See Architecture to understand:
- Project structure
- Role-based player system
- Firebase data flow
- ES6 module organization
See Firebase Setup for:
- Creating a Firebase project
- Configuring database rules
- Getting your credentials
- Security best practices
Stuck? Here's where to get help:
- 📖 Check the FAQ
- 🔧 See Troubleshooting
- 💬 Start a GitHub Discussion
- 🐛 Create a GitHub Issue
Ready to play or contribute? You're all set! 🎮🚀
TTT (Tic-Tac-Toe) | GitHub Repository | Report Issue | Contribute
Live Versions: Main • Beta • Alpha • Experimental
📚 Wiki: Home • Getting Started • Contributing Guidelines • FAQ
Made with ❤️ by Steven Farless | Licensed under GPL-3.0 | © 2025