Quick Start Guide
This guide will help you get the full stack running locally and create your first component interaction.Goal
By the end of this guide, you’ll have:- Both client and server running locally
- A working component showcase
- Your first tracked interaction
- Understanding of basic component usage
Prerequisites
Make sure you have completed the installation guide before proceeding.Running the Stack
Start the Client
Open a new terminal window and start the Next.js client:Wait for Next.js to compile:
Verify the Health Check
Open your browser or use curl to check the server status:You should receive:
Open the Application
Navigate to http://localhost:3000 in your browser.You should see the component showcase homepage with:
- Navigation bar with theme toggle
- Interactive component sections
- Button variants and examples
- Input fields and forms
- Cards and modals
Your First Component
Let’s explore how components work in the T1 Component Library by examining the Button component.Understanding the Button Component
The Button component fromclient/app/components/Button.tsx supports multiple variants, sizes, and states:
Button.tsx
Using the Button Component
Here are practical examples of using the Button component:Interaction Tracking
All component interactions are automatically tracked using theInteractionContext. Here’s how it works:
How Tracking Works
From the homepage (client/app/page.tsx):
page.tsx
Testing Interaction Tracking
Register a User (Optional)
Navigate to http://localhost:3000/registerCreate an account with:
- Name: Your name
- Email: [email protected]
- Password: Secure password
Registered users have their interactions tracked with their user ID. Anonymous users are tracked without identification.
Interact with Components
Go back to the homepage and click on various buttons, open modals, type in inputs, and hover over cards.Each interaction sends a request to the API:
View Statistics
Navigate to http://localhost:3000/dashboardYou’ll see:
- Total interaction count
- Interactions per component
- Interactions per action type
- Anonymous vs registered user breakdown
Export Data (Authenticated Only)
If you’re logged in, visit http://localhost:3000/exportsYou can:
- View paginated tracking data
- See timestamps and user information
- Export data for analysis
API Endpoints
Here are the key API endpoints you’ll use:Authentication
Tracking
Data Export (requires authentication)
Development Workflow
When developing, you’ll typically run both servers simultaneously: Terminal 1 - Server:Testing
Run the test suite to ensure everything works correctly:- Components (Button, Card, Input, Modal, Navbar)
- Contexts (Theme, Interaction)
- Utilities (API client)
- Integration tests
Common Tasks
Add a new component
Add a new component
- Create the component in
client/app/components/ - Add tests in
client/app/__tests__/components/ - Create a showcase section in
client/app/components/home/ - Add documentation to the docs page
Customize theme colors
Customize theme colors
Edit
client/app/globals.css to modify CSS variables:Add a new API endpoint
Add a new API endpoint
- Create route in
server/src/routes/ - Add controller in
server/src/controllers/ - Implement service logic in
server/src/services/ - Add validation middleware if needed
- Update API documentation
View logs
View logs
Server logs appear in the terminal where you ran
npm run dev.The server uses Morgan for HTTP logging and includes custom loggers for debugging.Next Steps
Now that you have the basics down:Explore Components
Learn about all available components
API Reference
Dive into the complete API documentation
Theming Guide
Customize the look and feel
Testing Guide
Learn about testing
Need help? Check the API Reference for detailed endpoint documentation or explore the Components guide.