-
Install Node.js Packages:
- Install
twingateandtwingetteusing npm:npm install twingate twingette
- Install
-
Set Up Server-Side Configuration:
- Create a
tsconfig.jsonfile with the following content:{ "compilerOptions": { "strict": true, "esModuleInterop": true, "skipLibCheck": true, "skipLibCheckForInterop": true, "esModuleInteropOptions": { "strict": true, "esModuleInteropError": true, "skipLibCheckForInteropError": true, "skipLibCheckForInteropError: strict": true, "skipLibCheckForInteropError: ignore": true } }, "moduleOptions": { "module": "twingate", }, "dependencies": { "twingate": "^X" } }Replace
Xwith the version number.
- Create a
-
Configure Browser Extension:
- Install the browser extension using
npm install twingate-ttl(if not already installed) and then run:npm install twingate-ttl
- Activate the extension:
npm run dev
- Enable browser extension:
bwise enable twingate
- Open the browser extension in your default browser.
- Install the browser extension using
-
Create the Main Page:
- In your browser extension, go to
chrome://extensions/and addtwingateas a new extension. - Create a new page with a simple HTML structure:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1."> <title>Twingate Client</title> <script src="https://unpkg.com/twingate/.11./twingate.min.js"></script> </head> <body> <div id="index"></div> </body> <script src="https://unpkg.com/twingate/.11./twingate.ts"></script> <script> import { main } from 'twingate'; main() { return new Node(''' <!DOCTYPE JS> <script language="javascript"> <script src="https://unpkg.com/twingate/.11./twingate.min.js"></script> <script> console.log('Welcome to Twingate! type "start" to begin.'); if (typeof window !== 'undefined' && 'start' in window) { window.start(); } </script> ''')(); ''')(); </body> <script> document.addEventListener('DOMContentLoaded', () => { console.log('Web content loaded.'); }); </script> - Save the file as
index.html.
- In your browser extension, go to
-
Add Components:
- Create a page tree:
< twingate-page path="index" children> < twingate-child path="home" children> < twingate-child path="about" children> < h1>About Twingate</h1> </ twingate-child> </ twingate-child> </ twingate-child> </ twingate-page> </ twingate-page> - This creates a simple page tree with an
aboutpage.
- Create a page tree:
-
Implement Authentication and Data Storage:
- Use OAuth for authentication:
npm install twingate-OAuth
- Configure the OAuth client:
npm install -D twingate-OAuth
- Update your app to use the OAuth client.
- Use OAuth for authentication:
-
Test the App:
- Open the browser extension and navigate to the URL of your app.
- Test the main page and components to ensure they load correctly.
-
Explore the Community:
Visit the Twingate community on GitHub or forums like GitHub Pages for additional resources and support.
By following these steps, you'll be able to start building and testing your Twingate client application.




