Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions docs/capabilities/server/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ Allows you to build apps where the end user can upload custom images to Reddit's

Allows you to query information from Reddit such as comments, posts and upvotes. Limited to installation scope of the application.

## [Scalable storage (Redis)](./redis.mdx)
## [Data storage (Redis)](./redis.mdx)

Allows you to store app data in a scalable database, free of charge. Limited to the installation scope of the application.
Allows you to store app data in a key-value database, free of charge. Limited to the installation scope of the application.

## [Scheduler](./scheduler.md)

Expand Down
25 changes: 25 additions & 0 deletions docs/capabilities/server/reddit-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,31 @@ Here's how to obtain a reference to the Reddit client
</TabItem>
</Tabs>

## Reddit Thing IDs

Reddit uses prefixed IDs (called "things") to identify different types of content:

| Prefix | Type | Example | Description |
| ------ | ---- | ------- | ----------- |
| `t1_` | Comment | `t1_abc123` | A comment on a post or reply to another comment |
| `t2_` | User | `t2_xyz789` | A Reddit user account |
| `t3_` | Post | `t3_def456` | A post |
| `t4_` | Message | `t4_ghi012` | A private message |
| `t5_` | Subreddit | `t5_jkl345` | A subreddit community |

These IDs are returned by API methods and used when referencing specific content:

```ts
// Get a post by its full ID
const post = await reddit.getPostById('t3_abc123');

// Get a comment by its full ID
const comment = await reddit.getCommentById('t1_xyz789');

// A comment's parentId can be either a post (t3_) or another comment (t1_)
const parentId = comment.parentId; // 't3_abc123' or 't1_def456'
```

## Example usage

### Submitting a post
Expand Down
2 changes: 1 addition & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,4 @@ We'd love to hear about your experience with Devvit Web! Join the conversation i
In addition to Devvit Web, release 0.12 also adds:

- **Post data** - [Post data](./capabilities/server/post-data.mdx) allows you to add data to your post when you submit it so that you can retrieve and use in your app without an additional Redis call.
- **Splash screen** - Having a compelling first screen of your app is one of the most important indicators of good post engagement. Every submitPost will come with a default per-post [splash screen](./capabilities/server/splash-screen.mdx) you can customize.
- **Splash screen** - Having a compelling first screen of your app is one of the most important indicators of good post engagement. Every submitPost will come with a default per-post splash screen.
4 changes: 0 additions & 4 deletions docs/earn-money/payments/payments_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,3 @@ You can use the sandbox to build and test payments, but before you can publish y
- Accept and comply with our [Earn Terms](https://redditinc.com/policies/earn-terms) and [Earn Policy](https://www.redditinc.com/policies/earn-policy).

All products will be reviewed by the Developer Platform team to ensure compliance with our content policy. Products are approved during the app review process after you publish your app.

:::note
Payment functionality is supported on [Devvit Blocks](../../capabilities/blocks/overview.md) only. [Devvit Web](../../capabilities/devvit-web/devvit_web_overview.mdx) is currently not supported.
:::
5 changes: 5 additions & 0 deletions docs/examples/template-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ Here are some starter projects and templates for your Devvit projects

- [Phaser starter](https://github.com/reddit/devvit-template-phaser) - a feature-rich HTML5 game framework for building 2D games in the browser. It includes preinstalled libraries for Devvit, Vite, Phaser, Express, and TypeScript. This template is good for handling physics, animations, input, sound, and asset management.

- [Unity starter](https://github.com/reddit/devvit-template-unity) - a template for building games with Unity. Includes setup for WebGL builds and integration with Devvit's server-side capabilities.

- [GameMaker starter](https://github.com/reddit/devvit-template-gamemaker) - a template for building games with GameMaker. Includes setup for HTML5 exports and integration with Devvit's server-side capabilities.

- [Hello world](https://github.com/reddit/devvit-template-hello-world/tree/main) - a simple template to build a counter app with no frameworks or opinions.


## Devvit Blocks

[Devvit Blocks](../capabilities/blocks/overview.md) lets you build applications that run inside of a Reddit post, using Reddit's own design system: optimized for performance and cross-platform compatibility.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Learn how your game can be featured across Reddit and reach thousands of players

## What is featuring?

Whether youre prototyping an early version of your first Reddit game or launching a polished experience to a wide audience, you have an opportunity to be featured. Our mission is to help developers grow by connecting their work with the Reddit users that will love it. Featuring selections are curated by our team and refreshed regularly to spotlight innovation, polished play, and player engagement.
Whether you're prototyping an early version of your first Reddit game or launching a polished experience to a wide audience, you have an opportunity to be featured. Our mission is to help developers grow by connecting their work with the Reddit users that will love it. Featuring selections are curated by our team and refreshed regularly to spotlight innovation, polished play, and player engagement.

Note that our top featuring slots are reserved for games that are of professional quality, as well as games that see exceptional engagement as they grow (CTR, dwell times, positive user engagement, retention).

Expand All @@ -34,15 +34,15 @@ Games that see organic growth are also likely to be scouted by our team for feat

Reddit features games and developers across multiple discovery surfaces to help players find new favorites:

- **Games Feed.** The Games Feed showcases playable experiences directly within Reddit. When featured, games are rotated into a list of games that is algorythmically served to users visiting the feed.
- **Games Feed.** The Games Feed showcases playable experiences directly within Reddit. When featured, games are rotated into a list of games that is algorithmically served to users visiting the feed.

![Featured games](../../assets/featured_games.png)
<img src={require('../../assets/featured_games.png').default} alt="Featured games" width="400" />

- **Community Drawer.** Our lefthand drawer provides an easy access point for any redditor to see a mix of recently played games and curated popular games.

![Community drawer web](../../assets/featured_cd_web.png)
<img src={require('../../assets/featured_cd_web.png').default} alt="Community drawer web" width="300" />

![Community drawer mobile](../../assets/featured_cd_mobile.png)
<img src={require('../../assets/featured_cd_mobile.png').default} alt="Community drawer mobile" width="300" />

- **Home Feed boosting.** One selected game per week is given an extra algorithmic boost in user home feeds, reaching broad audiences.
- **r/GamesOnReddit.** The curated [r/GamesOnReddit](https://www.reddit.com/r/GamesOnReddit/) banner highlights new and trending games for Reddit players.
Expand All @@ -52,11 +52,11 @@ Reddit features games and developers across multiple discovery surfaces to help

## Featuring tiers

| Tier | Description | Featuring Spots | Who Its For | Level of Polish | Approximate Impressions\* |
| Tier | Description | Featuring Spots | Who It's For | Level of Polish | Approximate Impressions\* |
| --------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ----------------------------------------------- | -------------------------------------------------- | ------------------------------------------- |
| **Distributed** | Games get initial exposure on r/GamesOnReddit featuring | Cross-posted by Reddit, pinned banner on r/GamesOnReddit | Developers seeking first players | Early builds of launched apps | Thousands |
| **Promoted** | Polished games selected to gain more visibility and engagement | Games Feed listing, more visibility in r/GamesOnReddit launch pad | Developers ready to expand their reach | Polished, working seamlessly across all platforms | Tens of thousands of impressions |
| **Highlighted** | High-performing games that drive significant player engagement | Games Feed top positions, added to Community Drawer recently played or one of the popular slots | Developers with highly polished, iterated games | Highly polished, optimized for scale and retention | Hundreds of thousands of impressions |
| **Highlighted** | High-performing games that drive significant player engagement | Games Feed top positions, added to Community Drawer "recently played" or one of the popular slots | Developers with highly polished, iterated games | Highly polished, optimized for scale and retention | Hundreds of thousands of impressions |
| **Hero** | Top-tier, standout games featured broadly across Reddit | Games Feed highlight, featured in Community Drawer, Home Feed highlight | Developers with flagship-quality games | Pro quality, high retention and engagement | Millions to tens of millions of impressions |

\*This is a rough estimate and does not reflect what any particular game will reach at this tier.
Expand All @@ -69,7 +69,7 @@ Games can be promoted to our highest featuring tiers if they see exceptional eng

In order to promote a game, we need to ensure the experience for redditors meets certain quality criteria. To be featured at any level you must have:

- **A compelling first screen.** Your game must have a custom [splash screen](https://developers.reddit.com/docs/capabilities/server/splash-screen).
- **A compelling first screen.** Your game must have a custom first screen.
- **Cross platform support.** Your game's viewport must be accessible and clean on both mobile and desktop platforms.
- **Self-explanatory design.** Anyone should be able to click into your post and have the context needed to learn, play, or participate.
- **Responsive design.** All screens should be visible within fullscreen, mobile, and desktop. Avoid unnecessary scrolls. Scrolling within inline webviews is prohibited.
Expand All @@ -78,7 +78,7 @@ In order to promote a game, we need to ensure the experience for redditors meets

## Featuring considerations

Our goal is to feature games that feel great to play and reflect Reddits creative spirit. With each featuring tier, the quality of featured apps becomes more stringent. Beyond the basic featuring requirements, we want to see:
Our goal is to feature games that feel great to play and reflect Reddit's creative spirit. With each featuring tier, the quality of featured apps becomes more stringent. Beyond the basic featuring requirements, we want to see:

- **Standout user experience.** Fast, intuitive, and responsive gameplay across devices.
- **Design and polish.** Cohesive visuals, appealing splash screens, and optimized mobile layouts.
Expand All @@ -91,6 +91,7 @@ Our goal is to feature games that feel great to play and reflect Reddit’s crea

## Celebrating your app

Games that reach featured tiers often see thousands of daily players and dedicated community followings. When your game is featured, youll receive promotional visibility through banners, feeds, and subreddit posts, as well as the opportunity to share your success across social channels and developer communities.
Games that reach featured tiers often see thousands of daily players and dedicated community followings. When your game is featured, you'll receive promotional visibility through banners, feeds, and subreddit posts, as well as the opportunity to share your success across social channels and developer communities.

See stories about successful games like [Honk](https://developers.reddit.com/docs/blog/honk) and [Syllocrostic](https://www.reddit.com/r/Devvit/comments/1n0vn97/reddit_has_acquired_syllacrostic/), which Reddit acquired after successful featuring.

53 changes: 34 additions & 19 deletions docs/guides/tools/logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,45 @@ Stream log events from your installed app to your command line to troubleshoot y

## Create logs

Any logs sent to `console` will be available via `devvit logs` for installed apps. For example, `console.log()`, `console.info()` and `console.error()` will produce logs with timestamps as expected.
Use `console.log()`, `console.info()`, and `console.error()` in your server code to create logs. View them with `devvit logs` for installed apps, or add `--verbose` to include timestamps.

The following example creates a basic app that simply creates a single log.
The following example creates a basic app with a menu action that creates a log when clicked.

```typescript title="main.tsx"
import { Context, Devvit } from '@devvit/public-api';
```json title="devvit.json"
{
"$schema": "https://developers.reddit.com/schema/config-file.v1.json",
"name": "app-name",

Devvit.addMenuItem({
location: 'post',
label: 'Create a log!',
onPress: (event, context) => {
console.log('Action called!');
context.ui.showToast(`Successfully logged!`);
"server": {
"dir": "dist/server",
"entry": "index.cjs"
},
});
"permissions": {
"reddit": true
},
"menu": {
"items": [
{
"label": "Create a log!",
"location": "subreddit",
"endpoint": "/internal/log-action",
"forUserType": "moderator"
}
]
}
}
```

export default Devvit;
```typescript title="server/index.ts"
router.post("/internal/log-action", async (_req, res): Promise<void> => {
console.log("log-action");
res.json({
showToast: {
text: "Log action",
appearance: "success",
},
});
});
```

## Stream logs
Expand Down Expand Up @@ -49,13 +71,6 @@ You should now see logs streaming onto your console:

To exit the streaming logger, enter `CTRL + c`.

Currently, `console.log` calls will only stream when they are run from the server (not the client).

:::note

Custom post apps use a client-side runtime to speed up execution, so `console.log` calls won't always show up in Devvit logs or Devvit playtest commands. However, these calls will show up in other dev tools (like Chrome) when viewing the app during a playtest.

:::

## Historical logs

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/tools/playtest.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The auto-generated playtest subreddit is created for you by u/devvit-dev-bot. Th
- Allows reddit admins to join your subreddit

:::note
If you need help, run `devvit playtest -help` for additional information.
If you need help, run `devvit playtest --help` for additional information.
:::

## View logs
Expand Down
1 change: 0 additions & 1 deletion sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ const sidebars: SidebarsConfig = {
type: "category",
label: "Splash Screens",
items: [
"capabilities/server/splash-screen",
"capabilities/server/launch_screen_and_entry_points/splash_migration",
],
},
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-0.11/playtest.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The auto-generated playtest subreddit is created for you by u/devvit-dev-bot. Th
- Allows reddit admins to join your subreddit

:::note
If you need help, run `devvit playtest -help` for additional information.
If you need help, run `devvit playtest --help` for additional information.
:::

## View logs
Expand Down
25 changes: 25 additions & 0 deletions versioned_docs/version-0.12/capabilities/server/reddit-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,31 @@ Here's how to obtain a reference to the Reddit client
</TabItem>
</Tabs>

## Reddit Thing IDs

Reddit uses prefixed IDs (called "things") to identify different types of content:

| Prefix | Type | Example | Description |
| ------ | ---- | ------- | ----------- |
| `t1_` | Comment | `t1_abc123` | A comment on a post or reply to another comment |
| `t2_` | User | `t2_xyz789` | A Reddit user account |
| `t3_` | Post | `t3_def456` | A post |
| `t4_` | Message | `t4_ghi012` | A private message |
| `t5_` | Subreddit | `t5_jkl345` | A subreddit community |

These IDs are returned by API methods and used when referencing specific content:

```ts
// Get a post by its full ID
const post = await reddit.getPostById('t3_abc123');

// Get a comment by its full ID
const comment = await reddit.getCommentById('t1_xyz789');

// A comment's parentId can be either a post (t3_) or another comment (t1_)
const parentId = comment.parentId; // 't3_abc123' or 't1_def456'
```

## Example usage

### Submitting a post
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-0.12/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,4 @@ We'd love to hear about your experience with Devvit Web! Join the conversation i
In addition to Devvit Web, release 0.12 also adds:

- **Post data** - [Post data](./capabilities/server/post-data.mdx) allows you to add data to your post when you submit it so that you can retrieve and use in your app without an additional Redis call.
- **Splash screen** - Having a compelling first screen of your app is one of the most important indicators of good post engagement. Every submitPost will come with a default per-post [splash screen](./capabilities/server/splash-screen.mdx) you can customize.
- **Splash screen** - Having a compelling first screen of your app is one of the most important indicators of good post engagement. Every submitPost will come with a default per-post splash screen.
5 changes: 5 additions & 0 deletions versioned_docs/version-0.12/examples/template-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ Here are some starter projects and templates for your Devvit projects

- [Phaser starter](https://github.com/reddit/devvit-template-phaser) - a feature-rich HTML5 game framework for building 2D games in the browser. It includes preinstalled libraries for Devvit, Vite, Phaser, Express, and TypeScript. This template is good for handling physics, animations, input, sound, and asset management.

- [Unity starter](https://github.com/reddit/devvit-template-unity) - a template for building games with Unity. Includes setup for WebGL builds and integration with Devvit's server-side capabilities.

- [GameMaker starter](https://github.com/reddit/devvit-template-gamemaker) - a template for building games with GameMaker. Includes setup for HTML5 exports and integration with Devvit's server-side capabilities.

- [Hello world](https://github.com/reddit/devvit-template-hello-world/tree/main) - a simple template to build a counter app with no frameworks or opinions.


## Devvit Blocks

[Devvit Blocks](../capabilities/blocks/overview.md) lets you build applications that run inside of a Reddit post, using Reddit's own design system: optimized for performance and cross-platform compatibility.
Expand Down
Loading