Skip to content
Open

Test #78

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3b2276f
chore: upgrade Astro v5 to v6 and update production dependencies
timbenniks Mar 23, 2026
9d27e81
version bump
harshitha-cstk Mar 23, 2026
b9edf3f
Merge pull request #56 from contentstack/chore/deps-update-2026-03-23
harshitha-cstk Mar 26, 2026
a82e12c
fix: dependency version bump and lock file update
cs-raj Apr 2, 2026
056d852
Merge pull request #60 from contentstack/fix/lock-file
cs-raj Apr 2, 2026
e0fb24c
chore: dependency updates
cs-raj Apr 22, 2026
3fb9399
Merge pull request #64 from contentstack/fix/snyk2
cs-raj Apr 22, 2026
ed22de9
chore: dependency update
cs-raj May 13, 2026
181ef6f
Merge pull request #65 from contentstack/fix/DX-7516
cs-raj May 13, 2026
5b3d0bb
fixed snyk issues
sunil-lakshman May 20, 2026
e1d5f01
Merge pull request #66 from contentstack/fix/snyk-fix
sunil-lakshman May 20, 2026
be35feb
chore: dependency update
cs-raj Jun 17, 2026
ca6caac
Merge pull request #67 from contentstack/fix/dependency
cs-raj Jun 17, 2026
60b3864
replace @timbenniks/contentstack-endpoints with @contentstack/utils
cs-raj Jun 18, 2026
1a915c2
issues-jira.yml
Aravind-Kumar-cstk Jun 19, 2026
d4d2a50
changed region from us to NA
cs-raj Jun 19, 2026
cdd1b53
Merge branch 'main' into enhc/DX-8581
cs-raj Jun 19, 2026
a6ef7a7
Merge pull request #68 from contentstack/enhc/DX-8581
cs-raj Jun 19, 2026
6004d62
chore: add Linux optional dependencies for Rollup and LightningCSS
cs-raj Jun 19, 2026
b204274
Merge branch 'main' into enhc/DX-8581
cs-raj Jun 19, 2026
15e72db
Merge pull request #69 from contentstack/enhc/DX-8581
cs-raj Jun 19, 2026
7b68e70
Delete issues-jira.yml
Aravind-Kumar-cstk Jun 30, 2026
064b9aa
fixed snyk
cs-raj Jul 1, 2026
c58faea
Merge pull request #71 from contentstack/fix/snyk
cs-raj Jul 1, 2026
2814090
updated astro, made it closer to the default setup
timbenniks Jul 6, 2026
5beccd4
Potential fix for pull request finding
harshitha-cstk Jul 9, 2026
626fe28
Potential fix for pull request finding
harshitha-cstk Jul 9, 2026
aedec91
Potential fix for pull request finding
harshitha-cstk Jul 9, 2026
ab01f0c
Potential fix for pull request finding
harshitha-cstk Jul 9, 2026
61689d1
Potential fix for pull request finding
harshitha-cstk Jul 9, 2026
b408e86
Merge pull request #73 from contentstack/feat/astro-update-lp-fix
harshitha-cstk Jul 9, 2026
b93f493
fix snyk issues
harshitha-cstk Jul 22, 2026
d7b63be
Merge pull request #75 from contentstack/fix/snyk-issues
harshitha-cstk Jul 22, 2026
eb9c773
fix snyk issues
harshitha-cstk Jul 29, 2026
7c96d9b
Merge pull request #76 from contentstack/fix/snyk-issues
harshitha-cstk Jul 30, 2026
38dbafd
sca-scan.yml
Aravind-Kumar-cstk Aug 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ PUBLIC_CONTENTSTACK_API_KEY=your_api_key_here
PUBLIC_CONTENTSTACK_DELIVERY_TOKEN=your_delivery_token_here
PUBLIC_CONTENTSTACK_PREVIEW_TOKEN=your_preview_token_here
PUBLIC_CONTENTSTACK_ENVIRONMENT=preview
PUBLIC_CONTENTSTACK_REGION=EU # Options: EU or NA
PUBLIC_CONTENTSTACK_REGION=EU # Options: NA, EU, AU, AZURE-NA, AZURE-EU, GCP-NA, GCP-EU
PUBLIC_CONTENTSTACK_PREVIEW=true # Set to true to enable preview
31 changes: 0 additions & 31 deletions .github/workflows/issues-jira.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .github/workflows/sca-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
jobs:
security-sca:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@master
- name: Run Snyk to check for vulnerabilities
Expand Down
57 changes: 55 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Contentstack Kickstart: Astro SSR
# Contentstack Kickstart: Astro

Contentstack Kickstarts are the minimum amount of code needed to connect to Contentstack.
This kickstart covers the following items:

- SDK initialization
- Live preview and Visual building setup

> This example has Contentstack Live preview set up SSR mode turnt on. Which means Contentstack adds query parameters to the URL which we grab in the code and give to the Live Preview SDK intance. Contentstack refreshes the browser on content edit each time.
> This example uses Astro's default static output and runs Contentstack Live Preview in client-side (CSR) mode. Pages are rendered at build time with published content; inside the Visual Builder the Live Preview SDK re-fetches the entry in the browser and re-renders the page on every edit — no server and no iframe refresh needed.

More details about this codebase can be found on the [Contentstack docs](https://www.contentstack.com/docs/developers).

Expand Down Expand Up @@ -75,6 +75,19 @@ PUBLIC_CONTENTSTACK_ENVIRONMENT=preview
PUBLIC_CONTENTSTACK_PREVIEW=true
```

### How live preview updates work

Live preview runs in client-side (CSR) mode: the Live Preview SDK is initialized with `ssr: false`, changes arrive in the browser via postMessage, and the page re-fetches the entry with the Delivery SDK and re-renders client-side — no iframe refresh. See `src/lib/renderPage.ts` for the client-side renderer.

### Timeline support

[Timeline](https://www.contentstack.com/docs/content-managers/timeline/preview-content-across-a-timeline) (previewing your site as it will look at a future date, with scheduled Releases applied) works out of the box:

- Timeline loads the site with `preview_timestamp` and `release_id` query params. The Delivery SDK picks these up automatically and sends them as headers to the Preview API, and `syncPreviewParams` in `src/lib/contentstack.ts` keeps them applied on every client-side re-fetch.
- Timeline's compare view (diff highlighting) relies on the `data-cslp` edit tags, which the client-side renderer preserves.

To use it, enable Timeline for your stack and schedule content with Releases. No code changes needed.

## Turn on Live Preview

Go to Settings > Live Preview. Click enable and select the `Preview` environment in the drop down. Hit save.
Expand Down Expand Up @@ -102,3 +115,43 @@ Go to `http://localhost:4321`.
Go to Entries and select the only entry in the list.
In the sidebar, click on the live preview icon.
Or, see your entry in the visual builder

## Regions and endpoint configuration

Set `PUBLIC_CONTENTSTACK_REGION` to the value matching your Contentstack account region:

| Region | Value |
|---|---|
| North America (default) | `NA` or `US` |
| Europe | `EU` |
| Australia | `AU` |
| Azure North America | `AZURE-NA` |
| Azure Europe | `AZURE-EU` |
| GCP North America | `GCP-NA` |
| GCP Europe | `GCP-EU` |

The app uses `getContentstackEndpoint` from `@contentstack/utils` to resolve the correct API hostnames for your region automatically. The following endpoint keys are resolved:

| Key | NA value |
|---|---|
| `contentDelivery` | `cdn.contentstack.io` |
| `preview` | `rest-preview.contentstack.com` |
| `application` | `app.contentstack.com` |
| `graphqlDelivery` | `graphql.contentstack.com` |
| `graphqlPreview` | `graphql-preview.contentstack.com` |
| `images` | `images.contentstack.io` |
| `assets` | `assets.contentstack.io` |
| `contentManagement` | `api.contentstack.io` |
| `auth` | `auth.contentstack.io` |

### Custom or dedicated environments

If you are on a dedicated or private cloud Contentstack instance, you can override the resolved endpoints via environment variables:

```
PUBLIC_CONTENTSTACK_CONTENT_DELIVERY=your-custom-cdn.example.com
PUBLIC_CONTENTSTACK_PREVIEW_HOST=your-custom-preview.example.com
PUBLIC_CONTENTSTACK_CONTENT_APPLICATION=your-custom-app.example.com
```

These override values take precedence over the region-resolved endpoints.
6 changes: 0 additions & 6 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
// @ts-check
import { defineConfig } from "astro/config";
import tailwindcss from "@tailwindcss/vite";
import node from "@astrojs/node";

// https://astro.build/config
export default defineConfig({
output: "server",
adapter: node({
mode: "standalone"
}),
vite: {
// @ts-ignore - tailwindcss plugin type compatibility
plugins: [tailwindcss()],
resolve: {
extensions: ['.js', '.mjs', '.ts', '.jsx', '.tsx', '.json'],
Expand Down
Loading
Loading