# Headspace

Stories by Headspace on Medium

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Open Sourcing Transformer Embeddings

DevFeed: [Open Sourcing Transformer Embeddings](<https://devfeed.tech/articles/open-sourcing-transformer-embeddings-24578.md>)

Original publisher: [Read original article](<https://medium.com/headspace-engineering/open-sourcing-transformer-embeddings-3c8cf6f4e540?source=rss-3da90e297190------2>)

Author: Headspace

Published: 2022-11-02T20:56:38Z

Content type: release

Language: en

Sources: [Headspace](<https://devfeed.tech/sources/stories-by-headspace-on-medium.md>)

Topics: [Embeddings](<https://devfeed.tech/topics/embeddings.md>), [vector embeddings in AI](<https://devfeed.tech/topics/vector-embeddings-in-ai.md>), [Machine learning](<https://devfeed.tech/topics/machine-learning.md>), [PyTorch](<https://devfeed.tech/topics/pytorch.md>), [scikit-learn](<https://devfeed.tech/topics/scikit-learn.md>)

Tags: [aggregation](<https://devfeed.tech/tags/aggregation.md>), [application](<https://devfeed.tech/tags/application.md>), [applications](<https://devfeed.tech/tags/applications.md>), [array](<https://devfeed.tech/tags/array.md>), [artifacts](<https://devfeed.tech/tags/artifacts.md>), [automatically](<https://devfeed.tech/tags/automatically.md>), [batch](<https://devfeed.tech/tags/batch.md>), [cpus](<https://devfeed.tech/tags/cpus.md>), [embeddings](<https://devfeed.tech/tags/embeddings.md>), [exploration](<https://devfeed.tech/tags/exploration.md>), [export](<https://devfeed.tech/tags/export.md>), [gpus](<https://devfeed.tech/tags/gpus.md>), [headspace](<https://devfeed.tech/tags/headspace.md>), [health](<https://devfeed.tech/tags/health.md>), [huggingface](<https://devfeed.tech/tags/huggingface.md>), [inference](<https://devfeed.tech/tags/inference.md>), [input](<https://devfeed.tech/tags/input.md>), [machine-learning](<https://devfeed.tech/tags/machine-learning.md>), [model](<https://devfeed.tech/tags/model.md>), [naturallanguageprocessing](<https://devfeed.tech/tags/naturallanguageprocessing.md>), [nlp](<https://devfeed.tech/tags/nlp.md>), [open](<https://devfeed.tech/tags/open.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [python](<https://devfeed.tech/tags/python.md>), [transformer](<https://devfeed.tech/tags/transformer.md>)

### AI overview

Headspace Health open-sourced `transformer-embeddings`, a PyTorch package published on PyPI for generating pooled embeddings from HuggingFace transformer models. It applies model-default tokenization, returns outputs aligned with inputs, supports mean, max, min, and pooler strategies, and lets users set batch sizes and run on CPUs or GPUs. The excerpt also describes exporting models and related artifacts to S3. The package is presented for exploration and inference, including real-time and batch workflows; it is not intended for fine-tuning or training models, or for TensorFlow and JAX. The authors suggest Hugging Face `transformers` or `sentence-transformers` for fine-tuning.

### Source excerpt

Photo by Jr Korpa on UnsplashBy Setu Shah, Staff Machine Learning Engineer The Data Science team at Headspace Health is a heavy user of building, training and production-izing transformer-based NLP models. Depending on the application, our NLP models operate at varying levels of atomicity: token, word, phrase, sentence, paragraph and document. A lot of our models rely on embeddings from off-the-shelf Transformer-based models, while some are fine-tuned for the application we are building for. Similarly, as a part of our work, we often try out different models during exploration, while comparing various pooling methods. About 18 months ago, we discovered the need for a streamlined way to use embeddings across our work for our exploration and production use cases. That is when we started building transformer-embeddings, an internal Python package that made it easy to interact with transformer-based models that are built using PyTorch. Today, we are open-sourcing this package and publishing it to PyPI to make it easy for anyone in the transformer and NLP communities to be able to use aggregated and pooled embeddings for phrases, sentences and paragraphs and documents, at varying levels of aggregation, in any of their applications. You should use this if you want to... Automatically apply tokenization (with the model defaults) before your model's forward pass. Stack outputs from the model into a single, iterable array that map 1:1 with your input. Simplify interactions with any transformer model available on the HuggingFace Model Hub for exploration and inference. Easily apply and compare the impact of different pooling strategies (mean, max, min, pooler) on your downstream tasks. Use your model on CPUs or GPUs, without worrying about if you asked PyTorch to use the right device. Export the model and additional artifacts (custom scikit-learn / tree-based models, model cards, etc.) to S3. Customize batch sizes for different models as you play with them. You should not use t

## Mindful Experimentation: Evaluate Recommendation System Performance using A/B Testing at Headspace

DevFeed: [Mindful Experimentation: Evaluate Recommendation System Performance using A/B Testing at Headspace](<https://devfeed.tech/articles/mindful-experimentation-evaluate-recommendation-system-performance-using-a-b-testing-at-headspace-24577.md>)

Original publisher: [Read original article](<https://medium.com/headspace-engineering/mindful-experimentation-evaluate-recommendation-system-performance-using-a-b-testing-at-headspace-3c8c05d0ae3b?source=rss-3da90e297190------2>)

Author: Headspace

Published: 2021-11-29T23:34:41Z

Content type: article

Language: en

Sources: [Headspace](<https://devfeed.tech/sources/stories-by-headspace-on-medium.md>)

Topics: [recommendation systems](<https://devfeed.tech/topics/recommendation-systems.md>), [product-experimentation](<https://devfeed.tech/topics/product-experimentation.md>), [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [Machine learning](<https://devfeed.tech/topics/machine-learning.md>)

Tags: [a-b-testing](<https://devfeed.tech/tags/a-b-testing.md>), [android](<https://devfeed.tech/tags/android.md>), [causal-inference](<https://devfeed.tech/tags/causal-inference.md>), [causality](<https://devfeed.tech/tags/causality.md>), [data-science](<https://devfeed.tech/tags/data-science.md>), [design](<https://devfeed.tech/tags/design.md>), [effectiveness](<https://devfeed.tech/tags/effectiveness.md>), [experiment](<https://devfeed.tech/tags/experiment.md>), [experimentation](<https://devfeed.tech/tags/experimentation.md>), [headspace](<https://devfeed.tech/tags/headspace.md>), [machine-learning](<https://devfeed.tech/tags/machine-learning.md>), [ml](<https://devfeed.tech/tags/ml.md>), [online](<https://devfeed.tech/tags/online.md>), [performance](<https://devfeed.tech/tags/performance.md>), [platform](<https://devfeed.tech/tags/platform.md>), [product-experimentation](<https://devfeed.tech/tags/product-experimentation.md>), [production](<https://devfeed.tech/tags/production.md>), [recommendation](<https://devfeed.tech/tags/recommendation.md>), [recommendation-system](<https://devfeed.tech/tags/recommendation-system.md>), [train](<https://devfeed.tech/tags/train.md>), [uncertainty](<https://devfeed.tech/tags/uncertainty.md>), [users](<https://devfeed.tech/tags/users.md>)

### AI overview

Headspace's Content Customizer uses historical data to recommend content, and the article argues that its overall effectiveness should be evaluated before production because the model is only one part of the recommendation system. It describes using a randomized online A/B test to estimate impact with statistical evidence. The experiment places recommendations in 19 slots across the Today tab, Hero modules, and recommended sub-tabs, and selects iOS and Android based on technical and business requirements; Web is also mentioned as a supported platform but is not included in this experiment. The excerpt begins discussing audience selection and the need for inference users to resemble the model's training data, but does not provide the full criteria or results.

### Source excerpt

Author: Rohan Singh Rajput. Rohan is a Senior Data Scientist at Headspace. He combines his passion for Machine Learning with Causal Inference to improve the mindfulness and meditation practices of Headspace users. "If you can't measure it, you can't improve it." -- Peter Drucker. Motivation Content Customizer is Headspace's personalized recommendation system. Content Customizer uses historical data to train its machine learning model and provide personalized recommendations to the users, helping them discover more relevant content. There are various components involved in building a recommendation system, and the ML model is only one of them. Therefore, it is essential to evaluate the effectiveness of the recommendation system as a whole before deploying it to production. Online Controlled Experiments help us to assess our system's impact with statistical evidence. Online Controlled Experiments, a.k.a A/B testing, are the gold standard for estimating causality with high probability. A data-driven decision-making culture helps estimate the measurement's uncertainty to refute the null hypothesis based on experimental data. Furthermore, a random assignment of the users into a control-treatment group allows us to safely ignore the unobserved factors and model the parameters as random variables1. Experiment Design The following components are required to design the experiment. Recommendation Surface Area: We have a total of three surface areas for this experiment: First, in the Today tab, we will use the last three slots to display ML recommendations. Figure 1: Dynamic Playlist on Today's Tab Second is the Hero module, which is the top banner area of the Meditate/Sleep/Focus/Move tabs. Lastly, we will be using the recommended sub-tabs that also have three slots each for ML-powered content. Figure 2: Hero and Recommended Module of other four tabs In total, we have 19 places available for the experiment. The platform for Recommendation: Headspace serves on multiple platform

## Explainable and Accessible AI: Using Push Notifications to Broaden the Reach of ML at Headspace

DevFeed: [Explainable and Accessible AI: Using Push Notifications to Broaden the Reach of ML at Headspace](<https://devfeed.tech/articles/explainable-and-accessible-ai-using-push-notifications-to-broaden-the-reach-of-ml-at-headspace-24573.md>)

Original publisher: [Read original article](<https://medium.com/headspace-engineering/explainable-and-accessible-ai-using-push-notifications-to-broaden-the-reach-of-ml-at-headspace-a03c7c2bbf06?source=rss-3da90e297190------2>)

Author: Headspace

Published: 2021-10-18T19:08:11Z

Content type: article

Language: en

Sources: [Headspace](<https://devfeed.tech/sources/stories-by-headspace-on-medium.md>)

Topics: [Push Notifications](<https://devfeed.tech/topics/push-notifications.md>), [recommendation systems](<https://devfeed.tech/topics/recommendation-systems.md>), [Machine learning](<https://devfeed.tech/topics/machine-learning.md>), [personalization](<https://devfeed.tech/topics/personalization.md>), [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [notifications](<https://devfeed.tech/topics/notifications.md>), [aws-sns](<https://devfeed.tech/topics/aws-sns.md>), [in-app experiences](<https://devfeed.tech/topics/in-app-experiences.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [android](<https://devfeed.tech/tags/android.md>), [app](<https://devfeed.tech/tags/app.md>), [apps](<https://devfeed.tech/tags/apps.md>), [backend](<https://devfeed.tech/tags/backend.md>), [braze](<https://devfeed.tech/tags/braze.md>), [client](<https://devfeed.tech/tags/client.md>), [cloud](<https://devfeed.tech/tags/cloud.md>), [cloud-services](<https://devfeed.tech/tags/cloud-services.md>), [communication](<https://devfeed.tech/tags/communication.md>), [communications](<https://devfeed.tech/tags/communications.md>), [content](<https://devfeed.tech/tags/content.md>), [context](<https://devfeed.tech/tags/context.md>), [customer](<https://devfeed.tech/tags/customer.md>), [customer-engagement](<https://devfeed.tech/tags/customer-engagement.md>), [email](<https://devfeed.tech/tags/email.md>), [headspace](<https://devfeed.tech/tags/headspace.md>), [machine-learning](<https://devfeed.tech/tags/machine-learning.md>), [ml](<https://devfeed.tech/tags/ml.md>), [notifications](<https://devfeed.tech/tags/notifications.md>), [push-notification](<https://devfeed.tech/tags/push-notification.md>), [push-notifications](<https://devfeed.tech/tags/push-notifications.md>)

### AI overview

Headspace built a pipeline that sends ML content recommendations to members through Braze push notifications, including people who have not recently opened the app. Scheduled Databricks jobs generate predictions and place payloads on SQS; a Lambda repackages them as Protobuf messages for the event bus, and the Braze service forwards them to Braze Canvases. Canvases handle audience segmentation, treatment/control tests, personalized message templates, and safeguards such as quiet hours and rate limits. The initial experiment used a Markov chain sequential recommender and reported a 78.65% lift in content completes among dormant members, plus lifts in direct opens and content starts/completes. Braze Intelligent Timing chooses send times from users' past messaging and app interactions; Headspace said it may later optimize timing for recommendation context, such as sending sleep content in the evening. The article emphasizes coordinating with Lifecycle Marketing, carefully testing internal sends, and refining notification copy.

### Source excerpt

Author: Matt Linder / Co-Author: Koyuki Nakamori TL;DR Headspace wanted to serve personalized content to members who had not recently opened the app We built out infrastructure that allowed us to leverage our Cloud services, plus the 3rd party Braze Customer Engagement platform, to serve Machine Learning-recommended content to members via push notifications Our first experiment doing so got GREAT results We implemented that experiment as an evergreen model in production You should, too Introduction and Problem Statement Headspace's core products are iOS, Android, and web-based apps that focus on improving the health and happiness of their users through mindfulness, meditation, sleep, exercise, and focus content. Machine learning models are core to our user experiences by offering recommendations that engage our users with relevant, personalized content that builds consistent habits in their lifelong journey. Headspace also has an amazing Lifecycle marketing team, who do incredible work in providing regular communications -- through email, push notifications, in-app modals, and other surfaces -- that further our users' engagement, helping them on their journey from prospects to members to advocates. Until recently, those two aspects -- Machine Learning and the out-of-app communication channels served by Lifecycle- were totally separate. Traditionally, users consume our ML models' personalized recommendations by Navigating to one of the app's tabs / views that contains content (for example, our Today tab). Sending a request from the app client to ask our backend content services to load content to serve users. Our content services then forward the request to our Prediction Service, which supplies a content recommendation for that user (or, if none is available, generates a default fallback content to serve). The Problem This approach has three primary limitations: It isn't able to directly respond to the immediate user's context. For instance, if a user has recently sear

## The MLOps Playbook: Best Practices for Ensuring Reliability of ML Systems

DevFeed: [The MLOps Playbook: Best Practices for Ensuring Reliability of ML Systems](<https://devfeed.tech/articles/the-mlops-playbook-best-practices-for-ensuring-reliability-of-ml-systems-24580.md>)

Original publisher: [Read original article](<https://medium.com/headspace-engineering/the-mlops-playbook-best-practices-for-ensuring-reliability-of-ml-systems-75203dc60763?source=rss-3da90e297190------2>)

Author: Headspace

Published: 2021-09-28T21:04:00Z

Content type: tutorial

Language: en

Sources: [Headspace](<https://devfeed.tech/sources/stories-by-headspace-on-medium.md>)

Topics: [MLOps](<https://devfeed.tech/topics/mlops.md>), [Machine learning](<https://devfeed.tech/topics/machine-learning.md>), [ML model versioning](<https://devfeed.tech/topics/ml-model-versioning.md>), [Model Development](<https://devfeed.tech/topics/model-development.md>), [Production Engineering](<https://devfeed.tech/topics/production-engineering.md>), [observability](<https://devfeed.tech/topics/observability.md>), [telemetry](<https://devfeed.tech/topics/telemetry.md>), [Feature Engineering](<https://devfeed.tech/topics/feature-engineering.md>), [versioning](<https://devfeed.tech/topics/versioning.md>), [performance-engineering](<https://devfeed.tech/topics/performance-engineering.md>), [CI/CD](<https://devfeed.tech/topics/cicd.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>)

Tags: [best-practices](<https://devfeed.tech/tags/best-practices.md>), [data-science](<https://devfeed.tech/tags/data-science.md>), [dataops](<https://devfeed.tech/tags/dataops.md>), [machine-learning](<https://devfeed.tech/tags/machine-learning.md>), [ml](<https://devfeed.tech/tags/ml.md>), [mlops](<https://devfeed.tech/tags/mlops.md>), [model](<https://devfeed.tech/tags/model.md>), [model-development](<https://devfeed.tech/tags/model-development.md>), [observability](<https://devfeed.tech/tags/observability.md>), [reliability](<https://devfeed.tech/tags/reliability.md>), [systems](<https://devfeed.tech/tags/systems.md>)

### AI overview

The playbook frames reliable MLOps as practices across development, deployment, and monitoring. During development, version model code, data, parameters, and metrics for reproducibility and rollback; account for operating cost when judging model complexity; evaluate quality across important time and location slices; and check for bias by examining inputs and predictions across groups. For deployment, it recommends reproducible training while recognizing nondeterminism from randomization and execution order, plus unit and pipeline integration tests, canary releases, and regularly practiced rollback procedures. For monitoring, track upstream dependencies, compare training and serving features to detect skew, test numerical edge cases, and monitor latency, throughput, and memory across models and data versions. Since true labels may arrive late, use online proxies such as prediction distributions to spot possible quality drift.

### Source excerpt

Author: Mo Messidi, a seasoned DataOps leader at Headspace with a decade of experience in both startups and enterprises. His mission is to help organizations operationalize their data. This article presents a simple, yet comprehensive, set of MLOps best practices for organizations to assess the production readiness of machine learning systems. It has also proved beneficial for assessing off-the-shelf MLOps platforms for feature and functionality completeness. There may be a whole range of software engineering best practices towards producing trustworthy software, but similar best practices for machine learning system operations are only in their infancy. Stage A: Model Development Model code, data, parameters, and metrics are version controlled It is important to know the code, data, and artifacts that produced a model. You can do this by having good version control for the model specification, including hyper-parameters and experiment artifacts. This ensures reproducibility, enables rollbacks, and de-risks system changes. A simpler model is not better The more complex a model, the higher its cost to operate. Adding a complexity tax to model assessment equations can help reveal the true incremental value of a given model. Model quality is sufficient for all important data slices ML models quality metrics can easily get lost in the averages when benchmarking against full datasets. It is important to examine quality independently for temporal and location variations. It is common for models to exhibit large drops in quality for specific data slices e.g. users in Denmark vs. users in Europe. The model is tested for considerations of inclusion ML unfairness may occur due to the way that people's choices affect what training data is used for something like word embedding. This can then lead to biased system behavior because it is based on these bad choices done during training data set creation. Measuring what you are doing is important to make systems for everyone. For

## Real-Time Machine Learning at Headspace

DevFeed: [Real-Time Machine Learning at Headspace](<https://devfeed.tech/articles/real-time-machine-learning-at-headspace-24571.md>)

Original publisher: [Read original article](<https://headspace.medium.com/infrastructure-design-for-real-time-machine-learning-inference-e140793d6741?source=rss-3da90e297190------2>)

Author: Headspace

Published: 2021-08-16T16:53:19Z

Content type: article

Language: en

Sources: [Headspace](<https://devfeed.tech/sources/stories-by-headspace-on-medium.md>)

Topics: [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [Machine learning](<https://devfeed.tech/topics/machine-learning.md>), [streaming data analytics](<https://devfeed.tech/topics/streaming-data-analytics.md>), [Event-Streaming](<https://devfeed.tech/topics/event-streaming.md>), [feature-store](<https://devfeed.tech/topics/feature-store.md>), [recommendation systems](<https://devfeed.tech/topics/recommendation-systems.md>), [personalization](<https://devfeed.tech/topics/personalization.md>), [model-deployment](<https://devfeed.tech/topics/model-deployment.md>), [AI Integration Strategies](<https://devfeed.tech/topics/ai-integration-strategies.md>), [Amazon SageMaker](<https://devfeed.tech/topics/amazon-sagemaker.md>), [Embeddings](<https://devfeed.tech/topics/embeddings.md>), [CI/CD](<https://devfeed.tech/topics/cicd.md>)

Tags: [apache-spark](<https://devfeed.tech/tags/apache-spark.md>), [aws](<https://devfeed.tech/tags/aws.md>), [databricks](<https://devfeed.tech/tags/databricks.md>), [headspace](<https://devfeed.tech/tags/headspace.md>), [headspace-engineering](<https://devfeed.tech/tags/headspace-engineering.md>), [inference](<https://devfeed.tech/tags/inference.md>), [lambda](<https://devfeed.tech/tags/lambda.md>), [layers](<https://devfeed.tech/tags/layers.md>), [machine-learning](<https://devfeed.tech/tags/machine-learning.md>), [real-time](<https://devfeed.tech/tags/real-time.md>), [recommendation](<https://devfeed.tech/tags/recommendation.md>), [sqs](<https://devfeed.tech/tags/sqs.md>)

### AI overview

Headspace describes a real-time recommendation pipeline intended to turn app activity into personalized content suggestions within a 30-second end-to-end latency target. Kinesis events are processed in Spark Structured Streaming micro-batches on Databricks, which update online features in SageMaker Feature Store and send jobs through SQS. Lambda functions combine online and offline features, invoke SageMaker endpoints, and route recommendations to an internal service for users to fetch or to queues for push delivery. The design uses SQS retries and lightweight Lambda orchestration; Spark's shared Python/Scala and custom micro-batching support are cited as benefits. Model updates require synchronizing the model with online feature stores, which can take up to 30 minutes; the proposed blue-green approach updates a parallel feature store before switching traffic. Headspace reports strong lifts in content starts, completions, and push open rates in initial experiments, while noting production use cases are still rolling out.

### Source excerpt

Author: Yu Chen, Senior Software Engineer / Co-author: Koyuki Nakamori, Senior Engineering Manager Introduction Data is often most valuable when it can be immediately leveraged to make decisions in the moment, but traditionally consumer data is ingested, transformed, persisted, and sits dormant for lengthy periods of time before being used by machine learning and analytics teams. Headspace's core products are iOS, Android, and web-based apps that focus on improving the health and happiness of its users through mindfulness, meditation, sleep, exercise, and focus content. Machine learning models are core to our user experiences by offering recommendations that engage our users with new relevant, personalized content that builds consistent habits in their lifelong journey. Finding a way to leverage user data to generate real-time insights and decisions means that consumer-facing products like the Headspace app can dramatically shorten the end-to-end user feedback loop: actions that users perform a few seconds, or minutes ago can be incorporated in generating a more relevant, personalized, and context-specific content recommendation for the user. This means our ML models could incorporate dynamic features that update throughout the course of a user's day, or even an individual session: Current session bounce rates for sleep content Semantic embeddings for recent user search terms (if a user recently searched for "preparing for big exam", the ML model can assign more weight to Focus-themed meditations) Users' biometric data (i.e., if step counts and heart rate are increasing over the last 10 minutes, we can recommend Move or Exercise content) The Headspace Machine Learning team architected a solution by decomposing the infrastructure systems into modular Publishing, Receiver, Orchestration, and Serving layers, leveraging Apache Spark Structured Streaming on Databricks, AWS SQS, Lambda, and Sagemaker to deliver real-time inference capabilities for our machine learning mod

## Web Authentication at Headspace using Auth0

DevFeed: [Web Authentication at Headspace using Auth0](<https://devfeed.tech/articles/web-authentication-at-headspace-using-auth0-24572.md>)

Original publisher: [Read original article](<https://headspace.medium.com/web-authentication-at-headspace-using-auth0-f60e0e539a2c?source=rss-3da90e297190------2>)

Author: Headspace

Published: 2021-04-26T20:43:56Z

Content type: article

Language: en

Sources: [Headspace](<https://devfeed.tech/sources/stories-by-headspace-on-medium.md>)

Topics: [Auth0](<https://devfeed.tech/topics/auth0.md>), [Single sign-on (SSO)](<https://devfeed.tech/topics/sso.md>), [Secure token management](<https://devfeed.tech/topics/secure-token-management.md>), [Access Control](<https://devfeed.tech/topics/access-control.md>), [Cookies](<https://devfeed.tech/topics/cookies.md>), [sessions](<https://devfeed.tech/topics/sessions.md>), [Single-page application (SPA)](<https://devfeed.tech/topics/spa.md>), [React](<https://devfeed.tech/topics/react.md>), [Web](<https://devfeed.tech/topics/web.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [auth0](<https://devfeed.tech/tags/auth0.md>), [authentication](<https://devfeed.tech/tags/authentication.md>), [backend](<https://devfeed.tech/tags/backend.md>), [cookies](<https://devfeed.tech/tags/cookies.md>), [headspace](<https://devfeed.tech/tags/headspace.md>), [requirements](<https://devfeed.tech/tags/requirements.md>), [web-authentication](<https://devfeed.tech/tags/web-authentication.md>)

### AI overview

Headspace chose Auth0 to support authentication across its web and mobile apps, with separate B2B and B2C access, permissions, and scalable service needs. Its embedded login uses auth0-js and returns JWTs that clients send in Authorization headers; backend routes check the expected tenant token and scopes, returning 401 for a tenant mismatch or 403 for insufficient scope. Embedded login kept users on Headspace domains, but Auth0's default third-party cookie could be blocked by browsers, causing login failures. Headspace's workaround was to configure an Auth0 custom domain, point a CNAME record to it, and update the auth0-js domain setting so cookies use that domain. The author also highlights Auth0 dashboard logs as useful for tracing authentication attempts and distinguishing provider-side success from backend bugs.

### Source excerpt

Author: Jesse Bond, Senior Software Engineer, Web Introduction: How does modern authentication work? Authentication allows users to securely log into a system and verify that they are who they say they are in subsequent requests. On today's web, this usually involves creating an account using a combination of username and password. Let's start with a quick refresher on how modern web authentication works. The first step is always a user submitting their login credentials into a form. Once the form is submitted, the server will determine whether or not the username and password match that of a previously registered user. If they do match, the server will return what is known as a session token. A session token is a unique identifier that authenticates requests as coming from the same user that just logged in. It's important to note that session tokens usually are temporary and have an expiration, which is determined by the server. Now that the user has a session token, each request will need to submit the session token to ensure authentication. It might sound tedious to have to submit the session token on each request, but have no fear, the cookie is here! Cookies are small bits of information that the browser stores for a domain. Cookies are also automatically submitted when a request is sent by the browser. Does this sound like a great way to handle the session token or what? Correct! Session tokens are almost always stored in a browser cookie to make authenticating requests a breeze. Authentication requirements Headspace has a large number of Single Page Apps, backend services, websites, and iOS and Android applications. We needed a robust solution for authentication that met the following requirements: Multiple platform and language support Scalable to millions of users Reliable with high uptime Ability to separate our users into different groups with varying permissions (i.e., admins vs. standard users) Ability to restrict user access to certain applications. Fo

## Filling the Stack: Five Things That Helped Me Transition From Frontend to Backend Development

DevFeed: [Filling the Stack: Five Things That Helped Me Transition From Frontend to Backend Development](<https://devfeed.tech/articles/filling-the-stack-five-things-that-helped-me-transition-from-frontend-to-backend-development-24574.md>)

Original publisher: [Read original article](<https://medium.com/headspace-engineering/filling-the-stack-five-things-that-helped-me-transition-from-frontend-to-backend-development-f9524b9548be?source=rss-3da90e297190------2>)

Author: Headspace

Published: 2021-03-30T18:57:45Z

Content type: article

Language: en

Sources: [Headspace](<https://devfeed.tech/sources/stories-by-headspace-on-medium.md>)

Topics: [Back end](<https://devfeed.tech/topics/backend.md>), [Full Stack Development](<https://devfeed.tech/topics/full-stack-development.md>), [backend frameworks](<https://devfeed.tech/topics/backend-frameworks.md>), [software-development](<https://devfeed.tech/topics/software-development.md>), [IntelliJ IDEA](<https://devfeed.tech/topics/intellij-idea.md>), [React](<https://devfeed.tech/topics/react.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [backend](<https://devfeed.tech/tags/backend.md>), [backend-development](<https://devfeed.tech/tags/backend-development.md>), [facebook](<https://devfeed.tech/tags/facebook.md>), [frontend](<https://devfeed.tech/tags/frontend.md>), [instagram](<https://devfeed.tech/tags/instagram.md>), [linkedin](<https://devfeed.tech/tags/linkedin.md>), [react](<https://devfeed.tech/tags/react.md>), [redux](<https://devfeed.tech/tags/redux.md>)

### AI overview

The author's move from frontend work to backend/API development at Headspace was supported by making career goals known, choosing Java and Spring Boot for their strong conventions and ready resources, and learning with help from colleagues. To get oriented, he attended API and Spring Boot meetings, read RFCs and feature specs, and asked questions. He built confidence through small contributions: improving onboarding documentation, reviewing pull requests, updating dependencies, and creating a request filter for audit logging that later became part of the service boilerplate. He presents these as practical ways to learn a new language, framework and IDE while contributing to a team.

### Source excerpt

A few tips on how I added Backend/API engineer to my list of skills while on the job at Headspace. Author: Lee Richardson, Senior Software Engineer Intro I started my career at Headspace (1000 years ago, way back in 2019!) as a Web engineer. Our frontend stack is primarily React, Redux, Redux-Saga, Emotion and several internal libraries for shared functionality/UI components. The first big feature I worked on was a group meditation feature, which we designed to be compatible with live audio or video streams. We were excited to add a live, community-minded feature into the app experience. After several initial product iterations, we decided to focus on other community-minded features, and our squad no longer needed a Web engineer (quick side note on what Headspace calls "squads" -- these are cross-functional groups organized around a particular business focus, usually containing a product owner, tech lead, and engineers across various disciplines). I started to feel lost, like my squad was moving onto bigger and better things and I was being left behind. After a few days of low-grade sulking, I started having conversations with engineers from other squads, taking a lap around the company to see what everyone was working on, and what might be a good fit for my skills. After some research, I transitioned to be primarily a backend engineer in late 2019.In this article, I share a few tips on how my skills expanded while on the job. Make Your Intentions Known When my future role became less defined, I started to doubt myself and my future at Headspace. After some mindful reflection and meditation, I was able to catch myself in a negative thought pattern and snap out of it. I had conversations with my manager and colleagues, to get a feel for what everyone was working on. I was explicit about wanting to find a new team. Word got out, and I eventually decided that I wanted to join the Headspace Health team to explore the healthcare space. I had previously worked with several