- Free Ory Cloud Account
- Free Supabase Account
- Ory CLI
- From your Supabase dashboard , click New project.
- Enter a Name for your Supabase project.
- Enter a secure Database Password.
- Select the Region you want.
- Click Create new project.
- Open table editor.
- Click on SQL editor on sidebar.
- Insert SQL table definition(see the code below)
- Click Run to create tables.
CREATE TABLE IF NOT EXISTS url (
id SERIAL PRIMARY KEY,
url VARCHAR(255) NOT NULL DEFAULT '',
hash varchar(10) NOT NULL DEFAULT '',
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
expired_at TIMESTAMP WITH TIME ZONE,
owner_id VARCHAR(36) NOT NULL DEFAULT ''
);
CREATE UNIQUE INDEX idx_url_hash ON url(hash);
CREATE TABLE IF NOT EXISTS url_view (
id SERIAL PRIMARY KEY,
referer VARCHAR(255) NOT NULL DEFAULT '',
url_id INT NOT NULL,
CONSTRAINT fk_url_view FOREIGN KEY(url_id) REFERENCES url(id)
);
Running ory proxy
export ORY_SDK_URL=https://projectid.projects.oryapis.com
ory proxy http://127.0.0.1:8090
Running the backend
export SUPABASE_KEY=... # Please add your key
export SUPABASE_URL=... # Please add your url
export KRATOS_API_URL=http://127.0.0.1:4000/.ory
export KRATOS_URL=http://127.0.0.1:4000/.ory/ui
go run cmd/shorts/main.go
cd client
npm i
export KRATOS_API_URL=http://127.0.0.1:4000/.ory
export KRATOS_URL=http://127.0.0.1:4000/.ory/ui
export API_URL=http://127.0.0.1:4000
npm run dev
Feel free to open a discussion to provide feedback or talk about ideas, or open an issue if you want to add your example to the repository or encounter a bug. You can contribute to Ory in many ways, see the Ory Contributing Guidelines for more information.