Welcome to SurrealPolls, where gathering votes and making decisions has never been easier (or more fun)! Whether you’re planning a group outing, running a class survey, or settling the eternal "pineapple on pizza" debate, we’ve got you covered.
Built with cutting-edge technologies like SolidJS, Vite, SurrealDB, Surreal Cloud, and Tailwind CSS, this app is as modern as your need for instant polls.
Spin up a poll in seconds. Just give it a title, list out some options, and BOOM! A shareable link is ready for your friends, colleagues, or anyone with an opinion.
Let your participants cast their votes effortlessly. The app ensures a seamless and real-time voting experience, so nobody’s left waiting.
Want to close the poll and announce the results? No problem! You’re in control. End the poll whenever you’re ready to seal the deal.
Results update in real-time, giving you instant insights into where everyone stands. No refresh button required!
Make sure you have the following installed:
Ready to dive in? Let’s go!
Clone the repo:
git clone https://github.com/your-repo/polling-app.git
cd polling-app
Install dependencies:
npm install
Connect to a SurrealDB Cloud Instance via CLI:
When you have a SurrealDB Cloud instance running, you can connect to it using the SurrealDB CLI and this will give you an endpoint to use in the make file.
Copy the endpoint without the surreal sql
prefix as you will be making an import into the database.
--endpoint <endpoint> --token <token>
We recommend using Surrealist the GUI for SurrealDB Cloud to manage and create your database users.
Create a database user in the Authentication section of Surrealist as you will need to use the username and password to connect to the database from the frontend.
Mirroring the .env.example
file, create an .env
file in the root of the project and set the VITE_DB_HOST
and DB_TOKEN
to the endpoint and token you copied from the CLI. Then, set the VITE_DB_USER
to root
and VITE_DB_PASS
to root
.
Apply the schema: Use the included Makefile to set up your database schema:
make apply
This will automatically apply all .surql files in the schema directory to your SurrealDB instance.
Configure SurrealDB in src/lib/providers/surrealdb.tsx
if needed (default is localhost).
Run the development server:
npm run dev
Open your browser at http://localhost:3000 and start polling!
Here’s how this masterpiece is organized:
/surrealpolls
|-- /src
| |-- /assets # Static assets like icons
| |-- /components # Reusable UI components
| | |-- Footer # Footer component
| | |-- Navbar # Navbar component
| |-- /lib # Logic and utility files
| | |-- /providers # Context providers (e.g., surrealdb.tsx)
| | |-- utils.ts # Helper functions
| |-- /pages # Pages for routing (Home, Create Poll, Vote, Results)
| |-- /styles # Global styles (index.css)
| |-- App.tsx # The main app component
| |-- index.tsx # Entry point of the app
| |-- routes.tsx # App routes
|-- /public # Public files (e.g., favicon)
|-- /.env.example # Example env file
|-- Makefile # For schema management
|-- tailwind.config.js # Tailwind configuration
|-- vite.config.ts # Vite configuration
Feel free to fork the repo, make improvements, and send us a pull request. We’re always open to ideas that make polling better (and cooler)!
This project is licensed under the MIT License—because sharing is caring. 😊
Happy polling! 🎉